]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
string list: Need to strdup return value on remove first.
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Tue, 2 Oct 2018 11:36:58 +0000 (12:36 +0100)
committerperexg <perex@perex.cz>
Tue, 2 Oct 2018 14:05:03 +0000 (16:05 +0200)
The id is part of the buffer itself (rather than separately
allocated), so need to strdup the id when returning first
element.

src/string_list.c

index 000d9cc9d498c3748a40ec687dc2682065bb3adb..2d851bf28d6549cc16651f47e7fa0f28d6020542 100644 (file)
@@ -58,7 +58,7 @@ string_list_remove_first(string_list_t *l)
   string_list_item_t *item = RB_FIRST(l);
   if (!item)
     return NULL;
-  ret = item->id;
+  ret = strdup(item->id);
   RB_REMOVE(l, item, h_link);
   free(item);
   return ret;