summaryrefslogtreecommitdiff
path: root/src/string_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_list.c')
-rw-r--r--src/string_list.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/string_list.c b/src/string_list.c
index 192ff19..e197749 100644
--- a/src/string_list.c
+++ b/src/string_list.c
@@ -47,8 +47,11 @@ int string_list_add(string_list_t* list, const char* string)
if(!list)
return -1;
- if(slist_add(list, strdup(string)) == NULL)
+ char* tmp = strdup(string);
+ if(slist_add(list, tmp) == NULL) {
+ free(tmp);
return -2;
+ }
return 0;
}