From ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 26 Aug 2015 12:17:18 +0100 Subject: maint: avoid useless "if (foo) free(foo)" pattern The free() and g_free() functions both happily accept NULL on any platform QEMU builds on. As such putting a conditional 'if (foo)' check before calls to 'free(foo)' merely serves to bloat the lines of code. Signed-off-by: Daniel P. Berrange Reviewed-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- hw/pci-host/prep.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'hw/pci-host') diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index c63f45d217..988907bfa0 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -328,9 +328,7 @@ static void raven_realize(PCIDevice *d, Error **errp) if (bios_size < 0 || bios_size > BIOS_SIZE) { hw_error("qemu: could not load bios image '%s'\n", s->bios_name); } - if (filename) { - g_free(filename); - } + g_free(filename); } } -- cgit v1.2.3