bug-gnu-utils
[Top][All Lists]
Advanced

[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: Mon, 15 Jan 2007 17:07:31 -0500
User-agent: Mutt/1.4.2.1i

On Mon, Jan 15, 2007 at 11:01:56PM +0100, Karel Zak wrote:
>  We don't talk about wstptr __deallocation__. There is still in free_wstr()
> 
>     if ((n->flags & WSTRCUR) != 0)
>         free(n->wstptr);
> 
>  .. so the wide string is deallocated only if WSTRCUR is set.
> 
>  We talk about __zeroing__  of wstptr, wstlen and flags. If you call
>  the free_wstr() which always zeroing MB stuff you can by always sure
>  that the NODE is in expected state. (Yes, it's paranoid.)

Right, but I simply don't see why anybody cares about the value of wstptr
if the WSTRCUR flag is not set.  Why does it matter?

>  I don't see any real problem with free_wstr(r) which also zeroing
>  independently on WSTRCUR.

I agree, it shouldn't matter, as long as the NODE is of the correct type.
But zeroing in all cases is just a (small) waste of CPU time that serves
to obfuscate the correctness of the code.

Regards,
Andy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]