[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2211] nagiosplug/trunk

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Sat Jun 6 07:56:26 CEST 2009


Revision: 2211
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2211&view=rev
Author:   dermoth
Date:     2009-06-06 05:56:26 +0000 (Sat, 06 Jun 2009)

Log Message:
-----------
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 at zedat.fu-berlin.de>

Modified Paths:
--------------
    nagiosplug/trunk/THANKS.in
    nagiosplug/trunk/lib/utils_base.c

Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in	2009-06-06 05:56:17 UTC (rev 2210)
+++ nagiosplug/trunk/THANKS.in	2009-06-06 05:56:26 UTC (rev 2211)
@@ -254,3 +254,4 @@
 Martin Foster
 Joe Presbrey
 Will Preston
+Nikita Kalabukhov

Modified: nagiosplug/trunk/lib/utils_base.c
===================================================================
--- nagiosplug/trunk/lib/utils_base.c	2009-06-06 05:56:17 UTC (rev 2210)
+++ nagiosplug/trunk/lib/utils_base.c	2009-06-06 05:56:26 UTC (rev 2211)
@@ -101,7 +101,9 @@
 {
 	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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list