From: Tomas Doran Date: Tue, 26 Feb 2013 12:43:21 +0000 (+0000) Subject: Fix memory leaks when plugin gets no results X-Git-Tag: collectd-4.10.9~10 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=61f60a27181027b73181dcb805ce319335a64fb2;p=collectd.git Fix memory leaks when plugin gets no results Signed-off-by: Florian Forster --- diff --git a/src/mysql.c b/src/mysql.c index 69df7c70..6f9efe35 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -557,6 +557,7 @@ static int mysql_read_master_stats (mysql_database_t *db, MYSQL *con) { ERROR ("mysql plugin: Failed to get master statistics: " "`%s' did not return any rows.", query); + mysql_free_result (res); return (-1); } @@ -565,6 +566,7 @@ static int mysql_read_master_stats (mysql_database_t *db, MYSQL *con) { ERROR ("mysql plugin: Failed to get master statistics: " "`%s' returned less than two columns.", query); + mysql_free_result (res); return (-1); } @@ -608,6 +610,7 @@ static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con) { ERROR ("mysql plugin: Failed to get slave statistics: " "`%s' did not return any rows.", query); + mysql_free_result (res); return (-1); } @@ -616,6 +619,7 @@ static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con) { ERROR ("mysql plugin: Failed to get slave statistics: " "`%s' returned less than 33 columns.", query); + mysql_free_result (res); return (-1); }