Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Feb 1997 02:22:03 -0500
From:      Andrew Herdman <andrew@why.whine.com>
To:        J Wunsch <j@uriah.heep.sax.de>
Cc:        Andrew Herdman <andrew@why.whine.com>, Poul-Henning Kamp <phk@critter.dk.tfs.com>, current@freebsd.org
Subject:   Re: Make world of Current dies with weird errors.
Message-ID:  <Pine.BSF.3.95.970209021828.485C-100000@why>
In-Reply-To: <Mutt.19970209005049.j@uriah.heep.sax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 8 Feb 1997, J Wunsch wrote:

> As Andrew Herdman wrote:
> 
> > Core was generated by `make'.
> > Program terminated with signal 6, Abort trap.
> > Cannot access memory at address 0x654f0.
> > #0  0x807de11 in ?? ()
> > (gdb) bt
> > #0  0x807de11 in ?? ()
> > #1  0x807d6e3 in ?? ()
> > #2  0x807c232 in ?? ()
> > #3  0x807c270 in ?? ()
> > #4  0x807d24b in ?? ()
> > #5  0x807d432 in ?? ()
> > #6  0x12731 in Lst_Destroy (l=0x588c0, freeProc=0)
> >     at /usr/src/usr.bin/make/lst.lib/lstDestroy.c:99
> 
> Do an ``up 6'', this should get you here.  There's most likely a
> free() call on line 99.  It seems this one is freed multiple times
> (for some reason).

Ok, here it is....

(gdb) up 6
#6  0x12731 in Lst_Destroy (l=0x588c0, freeProc=0)
    at /usr/src/usr.bin/make/lst.lib/lstDestroy.c:99
99                   free ((Address)ln);
(gdb) 

This is the function:

/*-
 *-----------------------------------------------------------------------
 * Lst_Destroy --
 *      Destroy a list and free all its resources. If the freeProc is
 *      given, it is called with the datum from each node in turn before
 *      the node is freed.
 *
 * Results:
 *      None.
 *
 * Side Effects:
 *      The given list is freed in its entirety.
 *
 *-----------------------------------------------------------------------
 */
void
Lst_Destroy (l, freeProc)
    Lst                 l;
    register void       (*freeProc) __P((ClientData));
{
    register ListNode   ln;
    register ListNode   tln = NilListNode;
    register List       list = (List)l;

    if (l == NILLST || ! l) {
        /*
         * Note the check for l == (Lst)0 to catch uninitialized static Lst's.
         * Gross, but useful.
         */
        return;
    }

    /* To ease scanning */
    if (list->lastPtr != NilListNode)
        list->lastPtr->nextPtr = NilListNode;
    else {
        free ((Address)l);
        return;
    }

    if (freeProc) {
        for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
             tln = ln->nextPtr;
             (*freeProc) (ln->datum);
             free ((Address)ln);
        }
    } else {
        for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
             tln = ln->nextPtr;
             free ((Address)ln); /* This is line 99 */
        }
    }
    
    free ((Address)l);
}



I look at this and my head hurts.  I'm afraid pascal was my language of
choice during my programming times.... :(

Andrew






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970209021828.485C-100000>