On 2014/10/11 11:26, Eric Blake wrote:

> On 10/10/2014 09:21 PM, Gonglei wrote:
> 
>>
>> Actually, I had noted that C standard says it is a no-operation.
>> But that doesn't mean that every C-library handles it like that.
> 
> EVERY libc that is C89 compliant handles it like that.  The last
> platform that failed on free(NULL) was SunOS 4, which is such
> museum-ware it's not funny.  There is no need to cater to platforms from
> 25 years ago.
> 

OK.Thanks for explanation!

>> Some people saw crashes for free(NULL), so it's best to avoid
>> calling the free in the first place (caller) or using  g_free() in 
>> qemu_vfree().
> 
> Absolutely not.  g_free is unsafe to use except for pointers from
> g_malloc, which is NOT the case that qemu_vfree is used on.
> 

Got it, thanks :)

But why some callers make a check,
but some other callers don't do this check?
Can I consider those check is superfluous?

-Best regards,
-Gonglei


Reply via email to