summaryrefslogtreecommitdiff
path: root/tools/image-host.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/image-host.c')
-rw-r--r--tools/image-host.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/image-host.c b/tools/image-host.c
index 84095d760c1..05d8c898209 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -716,11 +716,20 @@ static int strlist_add(struct strlist *list, const char *str)
{
char *dup;
+ if (!list || !str)
+ return -1;
+
dup = strdup(str);
+ if(!dup)
+ return -1;
+
list->strings = realloc(list->strings,
(list->count + 1) * sizeof(char *));
- if (!list || !str)
+ if (!list->strings) {
+ free(dup);
return -1;
+ }
+
list->strings[list->count++] = dup;
return 0;