[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk: other double free(_wstr)
From: |
Andrew J. Schorr |
Subject: |
Re: gawk: other double free(_wstr) |
Date: |
Sat, 13 Jan 2007 15:17:20 -0500 |
User-agent: |
Mutt/1.4.2.1i |
On Sat, Jan 13, 2007 at 08:52:30PM +0200, Aharon Robbins wrote:
> I think I'm going to undo the part of free_wstr that only zeros the
> fields if the flag is set.
Hmmm, this code that you plan to restore (zeroing wstptr even if the
WSTRCUR flag is not set) seems to conflict with a statement you made
back in July:
On Tue, Jul 18, 2006 at 10:22:41PM +0300, Aharon Robbins wrote:
> I have not yet read all this thread. The intent is that n->wstptr is NOT
> valid if the WSTRCUR bit is clear. Or to flip it around, only if the bit
> is set should you mess with n->wstptr.
That statement makes a lot of sense to me. The NODE is a big messy union; can
you be certain that zeroing wstptr won't stomp on some other meaningful part of
the union?
FWIW, I believe that this version of free_wstr is correct:
void
free_wstr(NODE *n)
{
if ((n->flags & WSTRCUR) != 0) {
assert(n->wstptr != NULL);
free(n->wstptr);
n->wstptr = NULL;
n->wstlen = 0;
n->flags &= ~WSTRCUR;
}
}
Regards,
Andy
- gawk: other double free(_wstr), Karel Zak, 2007/01/12
- Re: gawk: other double free(_wstr), Aharon Robbins, 2007/01/13
- Re: gawk: other double free(_wstr),
Andrew J. Schorr <=
- Re: gawk: other double free(_wstr), Karel Zak, 2007/01/15
- Re: gawk: other double free(_wstr), Andrew J. Schorr, 2007/01/15
- Re: gawk: other double free(_wstr), Karel Zak, 2007/01/15
- Re: gawk: other double free(_wstr), Andrew J. Schorr, 2007/01/15
- Re: gawk: other double free(_wstr), Karel Zak, 2007/01/15
Re: gawk: other double free(_wstr), Aharon Robbins, 2007/01/13
Re: gawk: other double free(_wstr), Aharon Robbins, 2007/01/16
Re: gawk: other double free(_wstr), Aharon Robbins, 2007/01/18
Re: gawk: other double free(_wstr), Aharon Robbins, 2007/01/27