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

Re: [E-devel] E CVS: libs/ecore sndev



On Sat, Jun 10, 2006 at 07:20:47PM +0200, Kim Woelders wrote:
> I forgot to mention - I think I have seen cases where c is zero. I'm not 
> sure malloc(0) always is legal.

It's legal.  Thus spake POSIX[1]:

    If size is 0, either a null pointer or a unique pointer that can be 
    successfully passed to free() shall be returned.

> Also, I have seen cases where v[] elements are NULL, in which case 
> strdup segv's.

Sounds like an Xlib bug, but it probably wouldn't hurt to code 
defensively anyways.

[1] http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html