Re: [PATCH 2/4] short circuit out of a few places where we would allocate zero bytes

From: Linus Torvalds <torvalds@osdl.org>
Date: 2005-12-28 15:38:10
On Tue, 27 Dec 2005, H. Peter Anvin wrote:
> 
> Better yet, either always return NULL or allocate 1 byte in that case, to get
> consistent behaviour.

Yes. However, if you do the "return NULL" case (which is nicest), you'll 
have to wrap "free()" too. There are some libraries where passing "free()" 
a NULL pointer causes a SIGSEGV.

That said, I think that would be preferable to changing the source code to 
unnecessarily avoid zero-sized allocations. Having a "xfree()" to match 
"xmalloc()" makes sense. 

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Dec 28 15:39:04 2005

This archive was generated by hypermail 2.1.8 : 2005-12-28 15:39:11 EST