From 012aef073461fd24a901d7a8742532093b7f6ae5 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 26 Aug 2015 14:02:53 +0200 Subject: maint: avoid useless "if (foo) free(foo)" pattern My Coccinelle semantic patch finds a few more, because it also fixes up the equally pointless conditional if (foo) { free(foo); foo = NULL; } Result (feel free to squash it into your patch): Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- vl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 76e0bb2..1c8b28d 100644 --- a/vl.c +++ b/vl.c @@ -534,10 +534,8 @@ const char *qemu_get_vm_name(void) static void res_free(void) { - if (boot_splash_filedata != NULL) { - g_free(boot_splash_filedata); - boot_splash_filedata = NULL; - } + g_free(boot_splash_filedata); + boot_splash_filedata = NULL; } static int default_driver_check(void *opaque, QemuOpts *opts, Error **errp) -- cgit v1.1