mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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>
This commit is contained in:
parent
4595a48a10
commit
ef1e1e0782
20 changed files with 39 additions and 93 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue