patch to stop freeing memory twice.

Richard Todd rmtodd at skywalker.ecn.ou.edu
Mon Sep 27 04:51:20 UTC 1999


This patch clears cp->In.Data and cp->Out.Data after the data they point to
are freed in CHANclose, thus making sure that we don't try to free the same
data again in CHANshutdown, thus littering the errlog with 
	innd in free(): warning: page is already free.
warnings from the malloc/free code.

Index: innd/chan.c
===================================================================
RCS file: /home/rmtodd/TempCVS/Temp-CVS-Repository/inn-current/innd/chan.c,v
retrieving revision 1.5
diff -u -r1.5 chan.c
--- chan.c	1999/09/26 20:35:33	1.5
+++ chan.c	1999/09/27 04:05:22
@@ -333,10 +333,12 @@
     if (cp->In.Size > BIG_BUFFER) {
 	cp->In.Size = 0;
 	DISPOSE(cp->In.Data);
+	cp->In.Data = NULL; /* avoid spurious free()s of already freed data in CHANshutdown */
     }
     if (cp->Out.Size > BIG_BUFFER) {
 	cp->Out.Size = 0;
 	DISPOSE(cp->Out.Data);
+	cp->Out.Data = NULL; /* ditto */
     }
     if (cp->Sendid.Size) {
 	cp->Sendid.Size = 0;


More information about the inn-patches mailing list