From fde599a2af8bf7ee090924fd2efa1d1a642855af Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 2 Oct 2013 18:18:13 +0200 Subject: [PATCH] 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) --- src/qemu/qemu_monitor_json.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2d841616d2..d37888a635 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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;