Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site sal.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!mcvax!enea!sal!jf From: jf@sal.UUCP (Johan Finnved) Newsgroups: net.news.b Subject: Bug in expire (eats too much memory) Message-ID: <191@sal.UUCP> Date: Sun, 31-Mar-85 01:10:14 EST Article-I.D.: sal.191 Posted: Sun Mar 31 01:10:14 1985 Date-Received: Wed, 27-Mar-85 04:18:11 EST Reply-To: jf@sal.UUCP (Johan Finnved) Organization: Objecta, Taby, Sweden Lines: 21 Summary: memory allocated for unrecognized header lines has to be freed PROBLEM: We are running news version B 2.10.1 6/24/83 (MC840302) and I have noted that expire crashes halfway through its work. This is because it gets out of memory in the routine "hread()" as unrecognized header lines are read into memory that is allocated with "malloc()" (without error checking of course). Since expire reads all files in the news database "hread()" gradually consumes more and more memory until malloc fails and the next unrecognized header line gets read into location zero .... SOLUTION: To fix the problem I have added an entry "hfree(hp)" in the module header.c to free storage allocated by "hread()", and I have added a call to "hfree()" in the main loop of expire.c (just after the call of hread since the unrecognized header fields aren't needed at all. I didn't want to free the storage in the beginning of hread (before it zeroes the header) since I don't know if the header sometimes gets allocated on the stack and thus can contain garbage that should not be mis-interpreted as pointers to storage to free. Johan Finnved OBJECTA Elektronik & Data AB, Sweden