Return-Path: mibsoft@epix.net
Delivery-Date: Fri, 22 Aug 1997 11:17:16 -0400
Received: from pear.epix.net (grape.epix.net [199.224.64.22]) by mail.cis.ohio-state.edu (8.6.7/8.6.4) with ESMTP id LAA00375 for <barr@cis.ohio-state.edu>; Fri, 22 Aug 1997 11:17:01 -0400
Received: from mibsoft1 (mibsoft.epix.net [199.224.77.137])
	by pear.epix.net (8.8.5/8.8.5/970414Scott Paul) with SMTP id LAA04460;
	Fri, 22 Aug 1997 11:16:42 -0400 (EDT)
Message-Id: <199708221516.LAA04460@pear.epix.net>
To: mibsoft@pear.epix.net, inn-workers@vix.com, inn-bugs@isc.org,
        barr@cis.ohio-state.edu
Date: Fri, 22 Aug 97 11:15:25 -0500
Newsgroups: news.software.nntp
Subject: FIX: 1.6b3 memory leak in expireover - expire~1.dif [1/1]
From: mibsoft@epix.net (Forrest J. Cavalier III)
Organization: Mib Software
X-Newsreader: WinVN 0.99.8 (16bit)
MIME-Version: 1.0
Content-Type: multipart/mixed;
     Boundary="*- Boundary Sn946+gqUW.Dq?'d-VSF"

--*- Boundary Sn946+gqUW.Dq?'d-VSF
Content-Type: Text/Plain; charset=US-ASCII

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---

