]> arthur.barton.de Git - netdata.git/commitdiff
coverity: 164803 Resource leak in ARL (impossible case)
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 19 Mar 2017 09:54:20 +0000 (11:54 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 19 Mar 2017 09:54:20 +0000 (11:54 +0200)
src/adaptive_resortable_list.c

index 7ae8ba1459f2c0eef7d64c0e7cd2aa14674c1cf0..f74c53eae5e192845ae57ed7975eb3ee9d8d5034 100644 (file)
@@ -233,9 +233,14 @@ int arl_find_or_create_and_relink(ARL_BASE *base, const char *s, const char *val
         if(base->head == base->next_keyword)
             base->head = e;
     }
-    else
+    else {
         e->prev = NULL;
 
+        if(!base->head)
+            base->head = e;
+    }
+
+    // prepare the next iteration
     base->next_keyword = e->next;
     if(unlikely(!base->next_keyword))
         base->next_keyword = base->head;