coverity: 164803 Resource leak in ARL (impossible case)
Costa Tsaousis (ktsaou) committed
Mar 19, 2017 at 11:54 UTC
5e3e00812270a051968e8a750e2ba9c92bae1a74
1 file changed
+6
-1
src/adaptive_resortable_list.c
+6
-1
@@ -233,9 +233,14 @@ int arl_find_or_create_and_relink(ARL_BASE *base, const char *s, const char *val
233
if(base->head == base->next_keyword)
234
base->head = e;
235
}
236
- else
236
+ else {
237
e->prev = NULL;
238
239
+ if(!base->head)
240
+ base->head = e;
241
+ }
242
+
243
+ // prepare the next iteration
244
base->next_keyword = e->next;
245
if(unlikely(!base->next_keyword))
246
base->next_keyword = base->head;