diff options
author | ghciv6 <ghciv6@localhost> | 2020-09-15 21:36:27 +0200 |
---|---|---|
committer | Jan Wagner <waja@cyconet.org> | 2021-04-10 13:43:12 +0200 |
commit | 7c32e6454000436086385be924dee74ee0fe1e8d (patch) | |
tree | 5de73aff422731a0a521efc8c02d8ef45d3274f1 | |
parent | 5a0ea60d76b84b8a78af9c5d9cd75cd7328f7784 (diff) | |
download | monitoring-plugins-7c32e6454000436086385be924dee74ee0fe1e8d.tar.gz |
- fix for issue #1562
1st compare then free up resources
-rw-r--r-- | plugins/check_mysql_query.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/check_mysql_query.c b/plugins/check_mysql_query.c index 49a14dd3..ac2fb15d 100644 --- a/plugins/check_mysql_query.c +++ b/plugins/check_mysql_query.c | |||
@@ -136,18 +136,18 @@ main (int argc, char **argv) | |||
136 | die (STATE_CRITICAL, "QUERY %s: Fetch row error - %s\n", _("CRITICAL"), error); | 136 | die (STATE_CRITICAL, "QUERY %s: Fetch row error - %s\n", _("CRITICAL"), error); |
137 | } | 137 | } |
138 | 138 | ||
139 | /* free the result */ | ||
140 | mysql_free_result (res); | ||
141 | |||
142 | /* close the connection */ | ||
143 | mysql_close (&mysql); | ||
144 | |||
145 | if (! is_numeric(row[0])) { | 139 | if (! is_numeric(row[0])) { |
146 | die (STATE_CRITICAL, "QUERY %s: %s - '%s'\n", _("CRITICAL"), _("Is not a numeric"), row[0]); | 140 | die (STATE_CRITICAL, "QUERY %s: %s - '%s'\n", _("CRITICAL"), _("Is not a numeric"), row[0]); |
147 | } | 141 | } |
148 | 142 | ||
149 | value = strtod(row[0], NULL); | 143 | value = strtod(row[0], NULL); |
150 | 144 | ||
145 | /* free the result */ | ||
146 | mysql_free_result (res); | ||
147 | |||
148 | /* close the connection */ | ||
149 | mysql_close (&mysql); | ||
150 | |||
151 | if (verbose >= 3) | 151 | if (verbose >= 3) |
152 | printf("mysql result: %f\n", value); | 152 | printf("mysql result: %f\n", value); |
153 | 153 | ||