]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuMonitorJSONSendKey: Avoid double free
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Oct 2013 16:18:13 +0000 (18:18 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 3 Oct 2013 06:57:57 +0000 (08:57 +0200)
After successful @cmd construction the memory where @keys points to is
part of @cmd. Avoid double freeing it.

src/qemu/qemu_monitor_json.c

index fc57c0057648b6aa9ba38489874ad2b79439586c..cd6cb72c126a700928f0e129fb0995ce97027238 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;