aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/strlist.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/strlist.c b/src/strlist.c
index 9cb09d0..d228405 100644
--- a/src/strlist.c
+++ b/src/strlist.c
@@ -15,9 +15,13 @@ void strlist_free(struct StrList *pStrList) {
return;
}
for (size_t i = 0; i < pStrList->num_inuse; i++) {
- free(pStrList->data[i]);
+ if (pStrList->data[i]) {
+ free(pStrList->data[i]);
+ }
+ }
+ if (pStrList->data) {
+ free(pStrList->data);
}
- free(pStrList->data);
free(pStrList);
}
@@ -164,6 +168,7 @@ void strlist_append_strlist(struct StrList *pStrList1, struct StrList *pStrList2
for (size_t i = 0; token[i] != NULL; i++) {
strlist_append(pStrList, token[i]);
}
+ split_free(token);
}
}