summaryrefslogtreecommitdiffstats
path: root/src/ulogd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ulogd.c')
-rw-r--r--src/ulogd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ulogd.c b/src/ulogd.c
index 97da4fc..6c5ff9a 100644
--- a/src/ulogd.c
+++ b/src/ulogd.c
@@ -661,12 +661,11 @@ pluginstance_alloc_init(struct ulogd_plugin *pl, char *pi_id,
}
size += pl->input.num_keys * sizeof(struct ulogd_key);
size += pl->output.num_keys * sizeof(struct ulogd_key);
- pi = malloc(size);
+ pi = calloc(1, size);
if (!pi)
return NULL;
/* initialize */
- memset(pi, 0, size);
INIT_LLIST_HEAD(&pi->list);
INIT_LLIST_HEAD(&pi->plist);
pi->plugin = pl;
@@ -1135,7 +1134,7 @@ static int parse_conffile(const char *section, struct config_keyset *ce)
"section \"%s\" not found\n", section);
break;
case -ERRTOOLONG:
- if (config_errce->key)
+ if (config_errce)
ulogd_log(ULOGD_ERROR,
"string value too long for key \"%s\"\n",
config_errce->key);
@@ -1335,6 +1334,15 @@ static void stop_pluginstances()
(*pi->plugin->stop)(pi);
pi->private[0] = 0;
}
+
+ /* NB: plugin->stop() might access other plugin instances,
+ * so we cannot free right away.
+ */
+ }
+ }
+
+ llist_for_each_entry(stack, &ulogd_pi_stacks, stack_list) {
+ llist_for_each_entry_safe(pi, npi, &stack->list, list) {
free(pi);
}
}