[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free |
Date: |
Fri, 10 Oct 2014 21:23:52 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 |
On 10/10/2014 08:54 PM, address@hidden wrote:
> From: Gonglei <address@hidden>
>
> 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 for use on pointers allocated by qemu_try_memalign and
friends (matching the name valloc which is an older spelling of
posix_memalign), which are NOT allocated by g_malloc. Furthermore,
free(NULL) is safe.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free,
Eric Blake <=