From e2d6bc3340605c346b71d03b323ed9da7b1f3ede Mon Sep 17 00:00:00 2001 From: William King Date: Fri, 24 May 2013 19:35:43 -0700 Subject: [PATCH] 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. --- src/mod/endpoints/mod_rtmp/libamf/src/amf0.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c b/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c index 4fed720469..9914d5ab21 100644 --- a/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c +++ b/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c @@ -60,13 +60,15 @@ static amf0_data * amf0_list_insert_after(amf0_list * list, amf0_node * node, am if (node != NULL) { amf0_node * new_node = (amf0_node*)malloc(sizeof(amf0_node)); if (new_node != NULL) { - new_node->next = node->next; - new_node->prev = node; - if (node->next != NULL) { node->next->prev = new_node; node->next = new_node; - } + new_node->prev = node; + } else { + node->next = new_node; + new_node->prev = node; + } + if (node == list->last_element) { list->last_element = new_node; }