File ntop-fix-segfault-on-exit.patch of Package ntop
Index: ntop.c
===================================================================
--- ntop.c.orig 2009-04-17 22:27:57.000000000 +0200
+++ ntop.c 2010-05-06 17:30:37.000000000 +0200
@@ -1203,8 +1203,10 @@ RETSIGTYPE cleanup(int signo) {
}
}
- if(myGlobals.device)
+ if(myGlobals.device) {
free(myGlobals.device);
+ myGlobals.device = NULL;
+ }
if(myGlobals.broadcastEntry != NULL) free(myGlobals.broadcastEntry);
if(myGlobals.otherHostEntry != NULL) {
Index: plugins/rrdPlugin.c
===================================================================
--- plugins/rrdPlugin.c.orig 2010-04-19 14:56:00.000000000 +0200
+++ plugins/rrdPlugin.c 2010-04-19 16:07:45.000000000 +0200
@@ -3077,7 +3077,10 @@ static void commonRRDinit(void) {
char *thePath = "/rrd";
int len = strlen(myGlobals.dbPath)+strlen(thePath)+16, idx = 0;
- if(myGlobals.rrdPath) free(myGlobals.rrdPath);
+ if(myGlobals.rrdPath) {
+ free(myGlobals.rrdPath);
+ myGlobals.rrdPath = NULL;
+ }
myGlobals.rrdPath = (char*)malloc(len);
#ifdef WIN32
safe_snprintf(__FILE__, __LINE__, myGlobals.rrdPath, len,
@@ -4130,7 +4133,10 @@ static void handleRRDHTTPrequest(char* u
int vlen = strlen(value)+1;
idx = 0;
vlen -= idx;
- if(myGlobals.rrdPath != NULL) free(myGlobals.rrdPath);
+ if(myGlobals.rrdPath != NULL) {
+ free(myGlobals.rrdPath);
+ myGlobals.rrdPath = NULL;
+ }
myGlobals.rrdPath = (char*)malloc(vlen);
unescape(myGlobals.rrdPath, vlen, &value[idx]);
revertSlashIfWIN32(myGlobals.rrdPath, 0);
@@ -5800,7 +5806,10 @@ static void termRRDfunct(u_char termNtop
}
if(hostsFilter != NULL) free(hostsFilter);
- if(myGlobals.rrdPath != NULL) free(myGlobals.rrdPath);
+ if(myGlobals.rrdPath != NULL) {
+ free(myGlobals.rrdPath);
+ myGlobals.rrdPath = NULL;
+ }
/*
The line below is not needed as the mutex/rrd-plugin