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 /migration | |
parent | 4595a48a10e576638795950b61957f83d2ed09b4 (diff) |
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 'migration')
-rw-r--r-- | migration/savevm.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/migration/savevm.c b/migration/savevm.c index 60712153fa..33e55fea09 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -551,9 +551,7 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) QTAILQ_FOREACH_SAFE(se, &savevm_state.handlers, entry, new_se) { if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { QTAILQ_REMOVE(&savevm_state.handlers, se, entry); - if (se->compat) { - g_free(se->compat); - } + g_free(se->compat); g_free(se->ops); g_free(se); } @@ -612,9 +610,7 @@ void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd, QTAILQ_FOREACH_SAFE(se, &savevm_state.handlers, entry, new_se) { if (se->vmsd == vmsd && se->opaque == opaque) { QTAILQ_REMOVE(&savevm_state.handlers, se, entry); - if (se->compat) { - g_free(se->compat); - } + g_free(se->compat); g_free(se); } } |