diff options
-rw-r--r-- | src/strlist.c | 12 | ||||
-rw-r--r-- | src/template.c | 2 | ||||
-rw-r--r-- | src/utils.c | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/strlist.c b/src/strlist.c index c2250ee..50bf2de 100644 --- a/src/strlist.c +++ b/src/strlist.c @@ -16,13 +16,13 @@ void strlist_free(struct StrList *pStrList) { } for (size_t i = 0; i < pStrList->num_inuse; i++) { if (pStrList->data[i]) { - free(pStrList->data[i]); + guard_free(pStrList->data[i]); } } if (pStrList->data) { - free(pStrList->data); + guard_free(pStrList->data); } - free(pStrList); + guard_free(pStrList); } /** @@ -39,7 +39,7 @@ void strlist_append(struct StrList *pStrList, char *str) { tmp = realloc(pStrList->data, (pStrList->num_alloc + 1) * sizeof(char *)); if (tmp == NULL) { - strlist_free(pStrList); + guard_strlist_free(pStrList); perror("failed to append to array"); exit(1); } else if (tmp != pStrList->data) { @@ -98,9 +98,9 @@ int strlist_append_file(struct StrList *pStrList, char *_path, ReaderFn *readerF for (size_t record = 0; data[record] != NULL; record++) { strlist_append(pStrList, data[record]); - free(data[record]); + guard_free(data[record]); } - free(data); + guard_free(data); fatal: if (filename != NULL) { diff --git a/src/template.c b/src/template.c index 39f01ac..7a5b0b9 100644 --- a/src/template.c +++ b/src/template.c @@ -45,9 +45,11 @@ void tpl_free() { if (item) { if (item->key) { free(item->key); + guard_free(item->key); } free(item); } + guard_free(item); } } diff --git a/src/utils.c b/src/utils.c index 74b4f6f..dd3dbe9 100644 --- a/src/utils.c +++ b/src/utils.c @@ -644,6 +644,8 @@ int fix_tox_conf(const char *filename, char **result) { fclose(fptemp); *result = tempfile; + guard_free(tempfile); + ini_free(&toxini); return 0; } |