]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONSendKey: Avoid double free
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Oct 2013 16:18:13 +0000 (18:18 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 15 Oct 2013 11:26:55 +0000 (13:26 +0200)
After successful @cmd construction the memory where @keys points to is
part of @cmd. Avoid double freeing it.
(cherry picked from commit 3e8343e1510741623aa5bc1dfb74ec39fde868dd)

src/qemu/qemu_monitor_json.c

index 7f3e0a60121c645af5685bfbb7d2acdf758713de..18abf22f91cb78dbd2d26758b3549127ba78f286 100644 (file)
@@ -3450,6 +3450,9 @@ int qemuMonitorJSONSendKey(qemuMonitorPtr mon,
     if (!cmd)
         goto cleanup;
 
+    /* @keys is part of @cmd now. Avoid double free */
+    keys = NULL;
+
     if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0)
         goto cleanup;