When mapping DB column names to input-keys, if we cannot find a key to match a column, the newly allocated `struct field` is leaked. Free it, and log an error message. Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- output/sqlite3/ulogd_output_SQLITE3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/output/sqlite3/ulogd_output_SQLITE3.c b/output/sqlite3/ulogd_output_SQLITE3.c index 554b1b34488c..41aeeec27854 100644 --- a/output/sqlite3/ulogd_output_SQLITE3.c +++ b/output/sqlite3/ulogd_output_SQLITE3.c @@ -342,8 +342,12 @@ sqlite3_init_db(struct ulogd_pluginstance *pi) } strncpy(f->name, buf, ULOGD_MAX_KEYLEN); - if ((f->key = ulogd_find_key(pi, buf)) == NULL) + if ((f->key = ulogd_find_key(pi, buf)) == NULL) { + ulogd_log(ULOGD_ERROR, + "SQLITE3: unknown input key: %s\n", buf); + free(f); return -1; + } TAILQ_INSERT_TAIL(&priv->fields, f, link); } -- 2.33.0