-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
The following line might be problematic:
last = &(cur->next);
If the program goes to the following line and if the statement is true:
if (cmp > 0) break;
The new node cannot be inserted in the correct position.
static bool list_insert(fr_hash_table_t *ht, fr_hash_entry_t **head, fr_hash_entry_t *node)
{
fr_hash_entry_t **last, *cur;
last = head;
for (cur = *head; cur != &ht->null; cur = cur->next) {
if (cur->reversed > node->reversed) break;
last = &(cur->next);
if (cur->reversed == node->reversed) {
if (ht->cmp) {
int8_t cmp = ht->cmp(node->data, cur->data);
if (cmp > 0) break;
if (cmp < 0) continue;
}
return false;
}
}
node->next = *last;
*last = node;
return true;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels