Luca:
I've used efence and found two memory problems. Fixing them solves the
shutdown hang in termIPServices() I've reported during shutdown, especially
under gdb/RedHat.
However, while one is probably the right fix, I'm not comfortable about #2,
so I'm bouncing it to you.
#1 - the docs on pcap_open_live() and pcap_close() indicate that the
resources are released by pcap_close() (although under debug it doesn't seem
to cleanup the structure, that's what the docs say). ElectricFence tags it
as a bad free.
=================================================
--- ntop.c.save Tue Jun 25 11:54:08 2002
+++ ntop.c Wed Jul 3 11:21:24 2002
@@ -980,7 +980,8 @@
*/
if(myGlobals.device[i].pcapPtr != NULL) {
pcap_close(myGlobals.device[i].pcapPtr);
- free(myGlobals.device[i].pcapPtr);
+ /* Resources are released by pcap_close() */
+ myGlobals.device[i].pcapPtr = NULL;
}
free(myGlobals.device[i].hashList);
=================================================
#2 I've also found via Electric-Fence that it was trying to free the
broadcast entry. Looking further, there is an explicit free plus one IF it
happens to be in the hostsCache.
I'm not committing this fix, because I suspect that we shouldn't be even
considering the broadcast entry (or the other entry) for the cache of freed
entries. I'm pretty sure this is being called during cleanup, so it is only
a bug if there are a small# of hosts and the entry(entries) are in the
cache. The conflict is with the explicit frees in ntop.c around 856.
It just seems to me that there should be a cleaner fix and you know this
area far better than I do...
So I'm dumping it in your lap and returning to sslwatchdog...
=================================================
--- hash.c.old Fri Jun 21 11:32:15 2002
+++ hash.c Wed Jul 3 11:12:51 2002
@@ -322,7 +322,8 @@
*/
if(myGlobals.hostsCacheLen < (MAX_HOSTS_CACHE_LEN-1)) {
- myGlobals.hostsCache[myGlobals.hostsCacheLen++] = host;
+ if(!broadcastHost(host))
+ myGlobals.hostsCache[myGlobals.hostsCacheLen++] = host;
} else {
/* No room left: it's time to free the bucket */
free(host);
=================================================
_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://lists.ntop.org/mailman/listinfo/ntop-dev