Subject: FIX: 1.6b3 memory leak in expireover - expire~1.dif [1/1]
From: [email-masked] (Forrest J. Cavalier III)
To: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Fri, 22 Aug 97 11:15:25 -0500
Newsgroups: news.software.nntp

INN 1.6b3/expire/expireover has a significant memory leak,
basically it allocates new space to store the headers for
each article processed, and never frees them.

I reported it to inn-workers yesterday, and I confirmed it
in "unit" testing today.

I don't know why code which appeared to work in 1.5.1 was
changed to what is in 1.6b3, but here is the fix for
1.6b3, and probably every 1.6.

(The fix is a bit "wordy" but it should make it safe even
if it is installed in 1.5.1 or 1.5.1sec2 by accident.)

Forrest Cavalier, Mib Software, INN customization and consulting

--*- Boundary Sn946+gqUW.Dq?'d-VSFL
Content-Type: Text/Plain; charset=ISO-8859-1

*** inn-1.6b3\expire\expireover.c.orig	Thu Jul 31 08:34:40 1997
--- inn-1.6b3\expire\expireover.c	Fri Aug 22 10:25:36 1997
***************
*** 451,456 ****
--- 451,469 ----
  	Headers = NEW(ARTOVERFIELD, ARTfieldsize);
  	for (hp = Headers, i = ARTfieldsize; --i >= 0; hp++)
  	    hp->Length = 0;
+     } else {
+ 	/* This disposes from the previous call.  This simplifies
+ 	   handling later on.  We trade off this readable code
+ 	   for the problem that nothing DISPOSEs() the last
+ 	   caller's use.  mibsoft 8/22/97
+ 	 */
+ 	for (hp = Headers, i = ARTfieldsize; --i >= 0; hp++) {
+ 	    if (hp->Header) {
+ 		DISPOSE(hp->Header);
+ 		hp->Header = 0;
+ 	    }
+ 	    hp->Length = 0;
+ 	}
      }
      for (hp = Headers, i = ARTfieldsize; --i >= 0; hp++)
  	hp->HasHeader = FALSE;
--*- Boundary Sn946+gqUW.Dq?'d-VSF---