Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-12 Thread Kevin Wolf
Am 11.10.2014 um 05:23 hat Eric Blake geschrieben: > On 10/10/2014 08:54 PM, arei.gong...@huawei.com wrote: > > From: Gonglei > > > > The caller of qemu_vfree() maybe not check whether parameter > > ptr pointer is NULL or not, such as vpc_open(). > > Using g_free() is more safe. > > NACK. g_fre

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread Gonglei
On 2014/10/11 11:44, Eric Blake wrote: > On 10/10/2014 09:32 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 >>

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread Eric Blake
On 10/10/2014 09:32 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,

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread Gonglei
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 > plat

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread Eric Blake
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

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread Eric Blake
On 10/10/2014 08:54 PM, arei.gong...@huawei.com wrote: > From: Gonglei > > The caller of qemu_vfree() maybe not check whether parameter > ptr pointer is NULL or not, such as vpc_open(). > Using g_free() is more safe. NACK. g_free is only safe for pointers allocated by g_malloc. qemu_vfree is fo

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread Gonglei
On 2014/10/11 11:10, Zhanghailiang wrote: > On 2014/10/11 10:54, arei.gong...@huawei.com wrote: >> From: Gonglei >> >> The caller of qemu_vfree() maybe not check whether parameter >> ptr pointer is NULL or not, such as vpc_open(). >> Using g_free() is more safe. >> > > It seems that free(NULL) i

Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread zhanghailiang
On 2014/10/11 10:54, arei.gong...@huawei.com wrote: From: Gonglei The caller of qemu_vfree() maybe not check whether parameter ptr pointer is NULL or not, such as vpc_open(). Using g_free() is more safe. It seems that free(NULL) is harmless. From section 7.20.3.2/2 of the C99 standard: The

[Qemu-devel] [PATCH] oslib-posix: change free to g_free

2014-10-10 Thread arei.gonglei
From: Gonglei The caller of qemu_vfree() maybe not check whether parameter ptr pointer is NULL or not, such as vpc_open(). Using g_free() is more safe. Signed-off-by: Gonglei --- util/oslib-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/oslib-posix.c b/util/os