From: Michal Privoznik Date: Wed, 2 Oct 2013 16:18:13 +0000 (+0200) Subject: qemuMonitorJSONSendKey: Avoid double free X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2484c1bde711864b02d0a606d9dcb912f3ad9d3a;p=thirdparty%2Flibvirt.git qemuMonitorJSONSendKey: Avoid double free After successful @cmd construction the memory where @keys points to is part of @cmd. Avoid double freeing it. (cherry picked from commit 3e8343e1510741623aa5bc1dfb74ec39fde868dd) --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2b73884eb6..16d58603fc 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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;