[monitoring-plugins] - fix for issue #1562
Jan Wagner
git at monitoring-plugins.org
Sat Apr 10 13:50:11 CEST 2021
Module: monitoring-plugins
Branch: wip-2.3.1
Commit: 7c32e6454000436086385be924dee74ee0fe1e8d
Author: ghciv6 <ghciv6 at localhost>
Committer: Jan Wagner <waja at cyconet.org>
Date: Tue Sep 15 21:36:27 2020 +0200
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=7c32e64
- fix for issue #1562
1st compare then free up resources
---
plugins/check_mysql_query.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/plugins/check_mysql_query.c b/plugins/check_mysql_query.c
index 49a14dd..ac2fb15 100644
--- a/plugins/check_mysql_query.c
+++ b/plugins/check_mysql_query.c
@@ -136,18 +136,18 @@ main (int argc, char **argv)
die (STATE_CRITICAL, "QUERY %s: Fetch row error - %s\n", _("CRITICAL"), error);
}
- /* free the result */
- mysql_free_result (res);
-
- /* close the connection */
- mysql_close (&mysql);
-
if (! is_numeric(row[0])) {
die (STATE_CRITICAL, "QUERY %s: %s - '%s'\n", _("CRITICAL"), _("Is not a numeric"), row[0]);
}
value = strtod(row[0], NULL);
+ /* free the result */
+ mysql_free_result (res);
+
+ /* close the connection */
+ mysql_close (&mysql);
+
if (verbose >= 3)
printf("mysql result: %f\n", value);
More information about the Commits
mailing list