]> 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 10:58:40 +0000 (12:58 +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 2d841616d28c1a3b2fd56ec14f8c85431a4945c5..d37888a635a5d6472b810f136fb724867d9f19bb 100644 (file)
@@ -3452,6 +3452,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;