Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
qemu-ga: Plug memory leak in guest_fsfreeze_cleanup()
Neglects to free errors allocated by qmp_guest_fsfreeze_thaw().
Spotted by Coverity.

While there, drop the test whether return value is negative (it's
never true), and improve logging.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
Markus Armbruster authored and mdroth committed Jan 28, 2013
1 parent 6034fe7 commit 6f68674
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions qga/commands-posix.c
Expand Up @@ -611,13 +611,14 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)

static void guest_fsfreeze_cleanup(void)
{
int64_t ret;
Error *err = NULL;

if (ga_is_frozen(ga_state) == GUEST_FSFREEZE_STATUS_FROZEN) {
ret = qmp_guest_fsfreeze_thaw(&err);
if (ret < 0 || err) {
slog("failed to clean up frozen filesystems");
qmp_guest_fsfreeze_thaw(&err);
if (err) {
slog("failed to clean up frozen filesystems: %s",
error_get_pretty(err));
error_free(err);
}
}
}
Expand Down

0 comments on commit 6f68674

Please sign in to comment.