Re: [PATCH] parse_object: check if buffer is non-NULL before freeing it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sun, 27 Aug 2006, Junio C Hamano wrote:
> 
> Eh, free(NULL) should work just fine.  It is "other places" that
> is misguided and needs to be fixed.

Well, some very old libraries will SIGSEGV on free(NULL). 

Admittedly those libraries are either very old or _very_ broken, but if 
you want to be strictly portable, you should not ever pass NULL to free(), 
unless you actually got it from a malloc(0) (and even then, it might be a 
really broken libc that just ran out of memory).

I actually suspect we should wrap all free() calls as "xfree()", which may 
also help us some day if we want to do any memory usage statistics.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]