]> 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:05:23 +0000 (13:05 +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 12f7e691155e892b685d3d2ff25c8e780fcc53a3..27e72ab8b59750e519f8c5cbc722ff856cd0fd6d 100644 (file)
@@ -3454,6 +3454,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;