aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-04-02 13:45:00 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-04-02 18:55:45 -0400
commit232763cb702e5b39ec5a051ec41582e42adaef59 (patch)
treecc27cbaf2550a579c04bb970b070f81d4769ca1b
parent3ed78a832d7de7649a0e2840bbba200bea4b650c (diff)
downloadstasis-232763cb702e5b39ec5a051ec41582e42adaef59.tar.gz
Lock output behind DEBUG define
-rw-r--r--src/ini.c9
-rw-r--r--src/template.c6
2 files changed, 14 insertions, 1 deletions
diff --git a/src/ini.c b/src/ini.c
index 55d092f..423e642 100644
--- a/src/ini.c
+++ b/src/ini.c
@@ -250,9 +250,18 @@ char *unquote(char *s) {
void ini_free(struct INIFILE **ini) {
for (size_t section = 0; section < (*ini)->section_count; section++) {
+#ifdef DEBUG
+ SYSERROR("freeing section: %s", (*ini)->section[section]->key);
+#endif
for (size_t data = 0; data < (*ini)->section[section]->data_count; data++) {
if ((*ini)->section[section]->data[data]) {
+#ifdef DEBUG
+ SYSERROR("freeing data key: %s", (*ini)->section[section]->data[data]->key);
+#endif
guard_free((*ini)->section[section]->data[data]->key);
+#ifdef DEBUG
+ SYSERROR("freeing data value: %s", (*ini)->section[section]->data[data]->value);
+#endif
guard_free((*ini)->section[section]->data[data]->value);
guard_free((*ini)->section[section]->data[data]);
}
diff --git a/src/template.c b/src/template.c
index 800c9be..6dcd4a8 100644
--- a/src/template.c
+++ b/src/template.c
@@ -44,10 +44,14 @@ void tpl_free() {
struct tpl_item *item = tpl_pool[i];
if (item) {
if (item->key) {
+#ifdef DEBUG
SYSERROR("freeing template item key: %s", item->key);
+#endif
guard_free(item->key);
}
+#ifdef DEBUG
SYSERROR("freeing template item: %p", item);
+#endif
item->ptr = NULL;
}
guard_free(item);
@@ -84,7 +88,7 @@ static int grow(size_t z, size_t *output_bytes, char **output) {
if (z >= *output_bytes) {
size_t new_size = *output_bytes + z + 1;
#ifdef DEBUG
- fprintf(stderr, "template output buffer new size: %zu\n", *output_bytes);
+ fprintf(stderr, "template output buffer new size: %zu\n", new_size);
#endif
char *tmp = realloc(*output, new_size);
if (!tmp) {