diff options
-rw-r--r-- | src/strlist.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/strlist.c b/src/strlist.c index 9e9bafb..bcb71dd 100644 --- a/src/strlist.c +++ b/src/strlist.c @@ -42,8 +42,9 @@ void strlist_append(struct StrList *pStrList, char *str) { strlist_free(pStrList); perror("failed to append to array"); exit(1); + } else if (tmp != pStrList->data) { + pStrList->data = tmp; } - pStrList->data = tmp; pStrList->data[pStrList->num_inuse] = strdup(str); pStrList->data[pStrList->num_alloc] = NULL; strcpy(pStrList->data[pStrList->num_inuse], str); |