summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bc827c9)
raw | patch | inline | side by side (parent: bc827c9)
author | Holger Weiss <holger@zedat.fu-berlin.de> | |
Mon, 1 Jun 2009 23:11:19 +0000 (01:11 +0200) | ||
committer | Holger Weiss <holger@zedat.fu-berlin.de> | |
Mon, 1 Jun 2009 23:11:19 +0000 (01:11 +0200) |
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>
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>
THANKS.in | patch | blob | history | |
lib/utils_base.c | patch | blob | history |
diff --git a/THANKS.in b/THANKS.in
index 189ba265d733840cb3fe944359526542f2d4ad47..aba48c6ba1c2bd73ba1d8c9b4d046258c3367f42 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
Martin Foster
Joe Presbrey
Will Preston
+Nikita Kalabukhov
diff --git a/lib/utils_base.c b/lib/utils_base.c
index 77700f5ba7e46079d5abb68c042c0694c79a77eb..4303e1592700bc96cbc752930a157387215f56ad 100644 (file)
--- 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
{
thresholds *temp_thresholds = NULL;
- temp_thresholds = malloc(sizeof(temp_thresholds));
+ if ((temp_thresholds = malloc(sizeof(thresholds))) == NULL)
+ die(STATE_UNKNOWN, _("Cannot allocate memory: %s\n"),
+ strerror(errno));
temp_thresholds->warning = NULL;
temp_thresholds->critical = NULL;