summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.c
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2009-06-01 23:11:19 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2009-06-01 23:11:19 (GMT)
commit9eabd8d054f003960daa150324873474df7aab60 (patch)
treecaaa3068532fb457959fb6812bf53a61d4c1968a /lib/utils_base.c
parentbc827c9083cdf7e6b4e6931f2eecfa7192baa48f (diff)
downloadmonitoring-plugins-9eabd8d054f003960daa150324873474df7aab60.tar.gz
Fix the memory allocation for the thresholds data
Allocate the appropriate amount of memory for storing the thresholds data. Before, we allocated the amount of memory required for storing a _pointer_ to the thresholds data. This crashed (at least) check_mysql when using its "-S" option on FreeBSD/amd64 (as reported and analyzed by Nikita Kalabukhov - 2797757). Signed-off-by: Holger Weiss <holger@zedat.fu-berlin.de>
Diffstat (limited to 'lib/utils_base.c')
-rw-r--r--lib/utils_base.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/utils_base.c b/lib/utils_base.c
index 77700f5..4303e15 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -101,7 +101,9 @@ _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_st
101{ 101{
102 thresholds *temp_thresholds = NULL; 102 thresholds *temp_thresholds = NULL;
103 103
104 temp_thresholds = malloc(sizeof(temp_thresholds)); 104 if ((temp_thresholds = malloc(sizeof(thresholds))) == NULL)
105 die(STATE_UNKNOWN, _("Cannot allocate memory: %s\n"),
106 strerror(errno));
105 107
106 temp_thresholds->warning = NULL; 108 temp_thresholds->warning = NULL;
107 temp_thresholds->critical = NULL; 109 temp_thresholds->critical = NULL;