summary refs log tree commit diff stats
path: root/qga/commands-posix.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2013-01-16 18:15:08 +0100
committerMichael Roth <mdroth@linux.vnet.ibm.com>2013-01-28 13:46:18 -0600
commit6f6867493cc00974de594a509cee5a3be61c64aa (patch)
tree8bebccd22d7c43bc3b1f3b4c94166274808901fc /qga/commands-posix.c
parent6034fe7bdb555c43022706e228cde8d52a8b341a (diff)
downloadfocaccia-qemu-6f6867493cc00974de594a509cee5a3be61c64aa.tar.gz
focaccia-qemu-6f6867493cc00974de594a509cee5a3be61c64aa.zip
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>
Diffstat (limited to 'qga/commands-posix.c')
-rw-r--r--qga/commands-posix.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 0ad73f3430..498f5ca46a 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -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);
         }
     }
 }