Appears to have been a copy paste error because this doesn't do what the api claims, and it also leaks the reference to the new node.
This commit is contained in:
parent
f3fd94b3e5
commit
e2d6bc3340
|
@ -60,13 +60,15 @@ static amf0_data * amf0_list_insert_after(amf0_list * list, amf0_node * node, am
|
||||||
if (node != NULL) {
|
if (node != NULL) {
|
||||||
amf0_node * new_node = (amf0_node*)malloc(sizeof(amf0_node));
|
amf0_node * new_node = (amf0_node*)malloc(sizeof(amf0_node));
|
||||||
if (new_node != NULL) {
|
if (new_node != NULL) {
|
||||||
new_node->next = node->next;
|
|
||||||
new_node->prev = node;
|
|
||||||
|
|
||||||
if (node->next != NULL) {
|
if (node->next != NULL) {
|
||||||
node->next->prev = new_node;
|
node->next->prev = new_node;
|
||||||
node->next = new_node;
|
node->next = new_node;
|
||||||
}
|
new_node->prev = node;
|
||||||
|
} else {
|
||||||
|
node->next = new_node;
|
||||||
|
new_node->prev = node;
|
||||||
|
}
|
||||||
|
|
||||||
if (node == list->last_element) {
|
if (node == list->last_element) {
|
||||||
list->last_element = new_node;
|
list->last_element = new_node;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue