Skip to content

Commit 4b1daad

Browse files
committed
engine: fix memory leaks with parse error handling in flb_slist_split_string.
Signed-off-by: Phillip Whelan <[email protected]>
1 parent 60db310 commit 4b1daad

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/flb_slist.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ int flb_slist_split_string(struct mk_list *list, const char *str,
274274

275275
ret = flb_slist_add_n(list, p_init, val_len);
276276
if (ret == -1) {
277+
flb_slist_destroy(list);
277278
return -1;
278279
}
279280
count++;
@@ -294,6 +295,7 @@ int flb_slist_split_string(struct mk_list *list, const char *str,
294295

295296
ret = flb_slist_add(list, p_end);
296297
if (ret == -1) {
298+
flb_slist_destroy(list);
297299
return -1;
298300
}
299301
count++;

0 commit comments

Comments
 (0)