From 61f60a27181027b73181dcb805ce319335a64fb2 Mon Sep 17 00:00:00 2001 From: Tomas Doran Date: Tue, 26 Feb 2013 12:43:21 +0000 Subject: [PATCH] Fix memory leaks when plugin gets no results Signed-off-by: Florian Forster --- src/mysql.c | 4 ++++ 1 file changed, 4 insertions(+) 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); } -- 2.30.2