]> 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 14:27:52 +0000 (16:27 +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 2b73884eb67e10cc521e609b53fea744f5de7531..16d58603fc4f05c5fbd6a751708acd76604d5219 100644 (file)
@@ -3407,6 +3407,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;