Fix improper handling of a double linked list that could have caused a memory leak.

This commit is contained in:
William King 2013-05-24 19:42:02 -07:00
parent b3aea78730
commit 83ae82fd2d
1 changed files with 4 additions and 2 deletions

View File

@ -40,11 +40,13 @@ static amf0_data * amf0_list_insert_before(amf0_list * list, amf0_node * node, a
if (new_node != NULL) {
new_node->next = node;
new_node->prev = node->prev;
if (node->prev != NULL) {
node->prev->next = new_node;
node->prev = new_node;
}
node->prev = new_node;
if (node == list->first_element) {
list->first_element = new_node;
}