diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2015-08-26 12:17:18 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2015-09-11 10:21:38 +0300 |
commit | ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374 (patch) | |
tree | 0b0f9a746055b66019016ed2d8e4ff9df7d79a8c /hw/core | |
parent | 4595a48a10e576638795950b61957f83d2ed09b4 (diff) | |
download | hqemu-ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374.zip hqemu-ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374.tar.gz |
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 <berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/core')
-rw-r--r-- | hw/core/loader.c | 3 | ||||
-rw-r--r-- | hw/core/qdev-properties.c | 4 |
2 files changed, 2 insertions, 5 deletions
diff --git a/hw/core/loader.c b/hw/core/loader.c index 216eeeb..a96a74e 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -594,8 +594,7 @@ static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, ret = hdr->ih_size; out: - if (data) - g_free(data); + g_free(data); close(fd); return ret; } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 04fd80a..33e245e 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -422,9 +422,7 @@ static void set_string(Object *obj, Visitor *v, void *opaque, error_propagate(errp, local_err); return; } - if (*ptr) { - g_free(*ptr); - } + g_free(*ptr); *ptr = str; } |