提交 5ab8746f 编写于 作者: D Daniel P. Berrange

Fix leak of JSON object for events

The event handler functions do not free the virJSONValuePtr
object. Every event received from a VM thus caused a memory
leak

* src/qemu/qemu_monitor_json.c: Fix leak of event object
上级 09a882bd
......@@ -122,7 +122,6 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
if (virJSONValueObjectHasKey(obj, "QMP") == 1) {
ret = 0;
virJSONValueFree(obj);
} else if (virJSONValueObjectHasKey(obj, "event") == 1) {
ret = qemuMonitorJSONIOProcessEvent(mon, obj);
} else if (virJSONValueObjectHasKey(obj, "error") == 1 ||
......@@ -130,6 +129,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
if (msg) {
msg->rxObject = obj;
msg->finished = 1;
obj = NULL;
ret = 0;
} else {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
......@@ -141,8 +141,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
}
cleanup:
if (ret < 0)
virJSONValueFree(obj);
virJSONValueFree(obj);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册