Xymon Mailing List Archive search

hobbitd_rrdtool core

list Henrik Størner
Thu, 3 Aug 2006 08:13:45 +0200
Message-Id: <user-5f370adbdc92@xymon.invalid>

On Fri, Jul 21, 2006 at 04:29:58PM -0500, Erich Zigler wrote:
Greetings,
 I have migrated from bigbrother to hobbit-4.2-beta-20060605. I have
followed the documentation and hobbitd_rrdtool is the only thing that is
not working properly. It keeps generating core files. The output is
attached to this message. Any help would be greatly appreciated.
This patch will solve this issue; against the current 4.2 RC.


Regards,
Henrik

-------------- next part --------------
--- hobbitd/rrd/do_sendmail.c	2006/07/09 21:10:14	1.12
+++ hobbitd/rrd/do_sendmail.c	2006/08/03 06:11:59
@@ -8,7 +8,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char sendmail_rcsid[] = "$Id: do_sendmail.c,v 1.12 2006/07/09 21:10:14 henrik Exp $";
+static char sendmail_rcsid[] = "$Id: do_sendmail.c,v 1.13 2006/08/03 06:11:57 henrik Exp $";
 
 int do_sendmail_rrd(char *hostname, char *testname, char *msg, time_t tstamp)
 {
@@ -115,16 +115,18 @@
 gotdata:
 			if (*rrdvalues) {
 				int dscount, i;
-				char **dsnames;
+				char **dsnames = NULL;
 
 				setupfn("sendmail.%s.rrd", mailer);
 
 				/* Get the RRD-file dataset count, so we can decide what to do */
 				dscount = rrddatasets(hostname, rrdfn, &dsnames);
 
-				/* Free the dsnames list */
-				for (i=0; (i<dscount); i++) xfree(dsnames[i]);
-				xfree(dsnames);
+				if ((dscount > 0) && dsnames) {
+					/* Free the dsnames list */
+					for (i=0; (i<dscount); i++) xfree(dsnames[i]);
+					xfree(dsnames);
+				}
 
 				if (dscount == 6) {
 					char *p;