[lxc-devel] strdup return value

Michael Tokarev mjt at tls.msk.ru
Thu Nov 19 11:54:00 UTC 2009


Daniel Lezcano wrote:
> Michael Tokarev wrote:
>> I wodner why all code checks for malloc return value
>> but almost no places checks for strdup.
>>
>> Maybe it is better idea to define xmalloc()/xstrdup()
>> that aborts if memory allocation failed, instead of
>> scattering error checking all over?
>>
>> Note that after the container is running, there's almost
>> no memory allocations anymore, so it wont fail while
>> everything is running.
>>   
> Isn't this done with libiberty ?
> 
> http://gcc.gnu.org/onlinedocs/libiberty/Memory-Allocation.html#Memory-Allocation 

Yeah, libiberty is one example of this.  One in row of countless others.

/mjt




More information about the lxc-devel mailing list