From: Florian Forster Date: Tue, 8 Dec 2015 10:49:56 +0000 (+0100) Subject: postgresql plugin: Remove invalid free(). X-Git-Tag: collectd-5.5.1~13^2~15 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ac7b4bd56283ba970c15fadaff15a4dad96fbf69;p=collectd.git postgresql plugin: Remove invalid free(). CID: 37936 --- diff --git a/src/postgresql.c b/src/postgresql.c index e613662a..78f6fe57 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -1161,7 +1161,7 @@ static int c_psql_config_writer (oconfig_item_t *ci) writers = tmp; writer = writers + writers_num; - ++writers_num; + memset (writer, 0, sizeof (*writer)); writer->name = sstrdup (ci->values[0].value.string); writer->statement = NULL; @@ -1181,10 +1181,10 @@ static int c_psql_config_writer (oconfig_item_t *ci) if (status != 0) { sfree (writer->statement); sfree (writer->name); - sfree (writer); return status; } + ++writers_num; return 0; } /* c_psql_config_writer */