From: Michal Privoznik Date: Tue, 3 May 2016 08:44:13 +0000 (+0200) Subject: qemuMonitorJSONQueryRxFilter: Validate qemu reply prior parsing it X-Git-Tag: v1.3.5-rc1~418 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3af81868982829ac543b6cfb510a59d3968e3eaa;p=thirdparty%2Flibvirt.git qemuMonitorJSONQueryRxFilter: Validate qemu reply prior parsing it Usually, the flow in this area of the code is as follows: qemuMonitorJSONMakeCommand() qemuMonitorJSONCommand() qemuMonitorJSONCheckError() parseReply() But in this function, for some reasons, the last two steps were swapped. This makes no sense. Signed-off-by: Michal Privoznik --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a48a263965..d5db60e749 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3401,14 +3401,14 @@ qemuMonitorJSONQueryRxFilter(qemuMonitorPtr mon, const char *alias, if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) goto cleanup; + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + if (qemuMonitorJSONQueryRxFilterParse(reply, filter) < 0) goto cleanup; ret = 0; cleanup: - if (ret == 0) - ret = qemuMonitorJSONCheckError(cmd, reply); - if (ret < 0) { virNetDevRxFilterFree(*filter); *filter = NULL;