Re: Someone stomping on our memory

From: Stephen R. van den Berg <srb@dont-contact.us>
Date: Mon, 20 Nov 2000 08:50:01 +0100

Andres Kroonmaa wrote:
>> > doesn't occur when mempools are disabled.
>> > Seems that we call xfree where we should call memFree.

>> > Looks like I can reproduce it quite reliably with requests
>> > ftp://username:password@ftp.site.com/

> I used --enable-xmalloc-debug with empty cache_swap. Did its job
> very well.

I hate to say it, but I squashed these leaks in my code more than two
years ago (which proves that you didn't look at my patch 8-).

>--- ftp.c Sat Jul 1 14:01:52 2000
>+++ ftp.c Mon Nov 13 22:50:11 2000
>@@ -1477,7 +1477,7 @@
> w = ftpState->pathcomps;
> ftpState->filepath = w->key;
> ftpState->pathcomps = w->next;
>- xfree(w);
>+ memFree(w,MEM_WORDLIST);
> /* Check if we are to CWD or RETR */
> if (ftpState->pathcomps != NULL || ftpState->flags.isdir) {
> ftpSendCwd(ftpState);

> I think this is pretty much it. bug present in HEAD.

From my old diffs:

diff -U 2 -b -B -p -r -d --horizon-lines=2 -X /usr/local/etc/xdiff squid-2.2.STA
BLE3/src/ftp.c squid-B2/src/ftp.c
--- squid-2.2.STABLE3/src/ftp.c Tue May 11 22:34:36 1999
+++ squid-B2/src/ftp.c Sun Jun 27 04:52:54 1999
@@ -1290,5 +1297,6 @@ ftpHandleControlReply(FtpStateData * ftp
     safe_free(ftpState->ctrl.last_reply);
     ftpState->ctrl.last_reply = (*W)->key;
- safe_free(*W);
+ memFree(*W, MEM_WORDLIST);
+ *W = 0;
     debug(9, 8) ("ftpReadControlReply: state=%d, code=%d\n", ftpState->state,
        ftpState->ctrl.replycode);
@@ -1460,5 +1468,5 @@ ftpTraverseDirectory(FtpStateData * ftpS
     ftpState->filepath = w->key;
     ftpState->pathcomps = w->next;
- xfree(w);
+ memFree(w, MEM_WORDLIST);
     /* Check if we are to CWD or RETR */
     if (ftpState->pathcomps != NULL || ftpState->flags.isdir) {

So it appears that you might have missed another spot still.
I didn't compare it with the current code yet.

-- 
Sincerely,                                                          srb@cuci.nl
           Stephen R. van den Berg (AKA BuGless).
I'm sorry. The number you have reached is imaginary.
Please rotate your phone 90 degrees and try again. 
Received on Mon Nov 20 2000 - 00:51:07 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:59 MST