diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-06-04 18:00:28 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-06-10 19:39:34 +0400 |
commit | a10678b08ecf87ef0b73426a876679178b392bcc (patch) | |
tree | 93d0139cf5090b2fdebfebd058d59f012b43e259 /hw | |
parent | 6998b6c11b4e8ca5e3c3e6bdbdf07a4f747d5d37 (diff) |
smbios: use g_free directly on NULL pointers
No need to wrap it with an if.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/i386/smbios.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c index b3bedde8b9..e3fa1b2fc1 100644 --- a/hw/i386/smbios.c +++ b/hw/i386/smbios.c @@ -745,11 +745,6 @@ void smbios_set_cpuid(uint32_t version, uint32_t features) field = value; \ } -#define G_FREE_UNLESS_NULL(ptr) \ - if (ptr != NULL) { \ - g_free(ptr); \ - } - void smbios_set_defaults(const char *manufacturer, const char *product, const char *version, bool legacy_mode) { @@ -758,7 +753,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product, /* 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 types > 1 */ if (find_next_bit(have_fields_bitmap, SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) { @@ -767,7 +762,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product, exit(1); } } else { - G_FREE_UNLESS_NULL(smbios_entries); + g_free(smbios_entries); } SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer); |