From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsZlx-0004hj-B4 for qemu-devel@nongnu.org; Thu, 05 Jun 2014 11:40:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsZlr-0004bo-Hq for qemu-devel@nongnu.org; Thu, 05 Jun 2014 11:40:09 -0400 Date: Thu, 5 Jun 2014 17:40:00 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140605153959.GA6798@irqsave.net> References: <1401897628-13422-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1401897628-13422-1-git-send-email-pbonzini@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] smbios: use g_free directly on NULL pointers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org The Wednesday 04 Jun 2014 =E0 18:00:28 (+0200), Paolo Bonzini wrote : > No need to wrap it with an if. >=20 > Signed-off-by: Paolo Bonzini > --- > hw/i386/smbios.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) >=20 > diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c > index 7660718..ab89420 100644 > --- a/hw/i386/smbios.c > +++ b/hw/i386/smbios.c > @@ -740,11 +740,6 @@ void smbios_set_cpuid(uint32_t version, uint32_t f= eatures) > field =3D value; = \ > } > =20 > -#define G_FREE_UNLESS_NULL(ptr) = \ > - if (ptr !=3D NULL) { = \ > - g_free(ptr); = \ > - } > - > void smbios_set_defaults(const char *manufacturer, const char *product= , > const char *version, bool legacy_mode) > { > @@ -753,7 +748,7 @@ void smbios_set_defaults(const char *manufacturer, = const char *product, > =20 > /* drop unwanted version of command-line file blob(s) */ > if (smbios_legacy) { > - G_FREE_UNLESS_NULL(smbios_tables); > + g_free(smbios_tables); > /* in legacy mode, also complain if fields were given for type= s > 1 */ > if (find_next_bit(have_fields_bitmap, > SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) { > @@ -762,7 +757,7 @@ void smbios_set_defaults(const char *manufacturer, = const char *product, > exit(1); > } > } else { > - G_FREE_UNLESS_NULL(smbios_entries); > + g_free(smbios_entries); > } > =20 > SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer); > --=20 > 1.8.3.1 >=20 >=20 Reviewed-by: Benoit Canet