Memory bug fixed
Andreas Jaeger
aj@suse.de
Fri Jul 14 02:16:00 GMT 2000
>>>>> Wolfram Gloger writes:
>> From: Andreas Jaeger <aj@suse.de>
>>
>> >>>>> Ulrich Drepper writes:
>>
Uli> Andreas Jaeger <aj@suse.de> writes:
>> >> Shall I revert the patch and change fgetspent.c also? Should we teach
>> >> mtrace to not emit an error message for free(0) ?
>>
Uli> Yes and yes.
>>
>> Here's a patch. Is this one ok?
>>
>> Andreas
>>
>> 2000-07-13 Andreas Jaeger <aj@suse.de>
>>
>> * malloc/mtrace.pl (location): Ignore free(0).
>>
>> * sysdeps/unix/sysv/linux/getsysstats.c (free_mem): Revert last
>> patch.
>>
>> * grp/fgetgrent.c (free_mem): Remove if - free (0) is valid.
Wolfram> Just to add my 2 cents -- this is exactly the right approach. Keep in
Wolfram> mind that free(0) extends to C++, and `delete p' with p==0 is even
Wolfram> more common than in C. Memory debuggers should always ignore it, at
Wolfram> the very least there needs to be a switch in them defaulting to `off'
Wolfram> WRT to checking for free(0) explicitly.
I've added my patch but didn't add the mtrace.pl change since Uli
commited last night:
* malloc/mtrace.c (tr_freehook): Return immediately if ptr is NULL.
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
More information about the Libc-hacker
mailing list