From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcnJu-0004ml-Ha for qemu-devel@nongnu.org; Fri, 10 Oct 2014 23:26:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XcnJn-0006WR-Ad for qemu-devel@nongnu.org; Fri, 10 Oct 2014 23:26:14 -0400 Message-ID: <5438A349.9090403@redhat.com> Date: Fri, 10 Oct 2014 21:26:01 -0600 From: Eric Blake MIME-Version: 1.0 References: <1412996048-6384-1-git-send-email-arei.gonglei@huawei.com> <54389FB1.8040207@huawei.com> <5438A223.2040402@huawei.com> In-Reply-To: <5438A223.2040402@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="j1j57A6oxkKNOqBq4MSuP6AgjBPfnNjEt" Subject: Re: [Qemu-devel] [PATCH] oslib-posix: change free to g_free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gonglei , Zhanghailiang Cc: "kwolf@redhat.com" , "Huangweidong (C)" , "qemu-trivial@nongnu.org" , "qemu-devel@nongnu.org" , "stefanha@redhat.com" , "pbonzini@redhat.com" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --j1j57A6oxkKNOqBq4MSuP6AgjBPfnNjEt Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/10/2014 09:21 PM, Gonglei wrote: >=20 > 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. > 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --j1j57A6oxkKNOqBq4MSuP6AgjBPfnNjEt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUOKNJAAoJEKeha0olJ0NqxEYH/2o34zhb+9uiAMNzK8GjSsET hecaFPBawd0VASl5WRK4KAWPp5I2RnzSUuLnYVBcwx2mlXptUfyvB59StxbvuL9V jz2IPQvMlq4ybk7sUSdlvCe2XbHOFuIVnshuCZ+zT+wRBOK+b+jjbulIypLVV7RN 4zVIRZAzC73vSnIboLNtcSixlxkKTm8nrYQ7/bPVc89jvaJVB1YLX86OJwosWO9w 17rq6aSOPGRZMUM4PaNLll3QlpuOdxhcfD2Ed9mS1YSQ2KPsV/wFVUrRSBflcynw vnGPmDD5AJu75ffA6WxYohIyUCFqOwO4U179kZMb+HzSb2oWvZOK9Ygo3gBZJE8= =FCg5 -----END PGP SIGNATURE----- --j1j57A6oxkKNOqBq4MSuP6AgjBPfnNjEt--