From 3d72f9a2be640f368229d579e80ce4ef2a823e49 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Fri, 8 Jan 2010 16:45:53 -0200 Subject: [PATCH] QMP: Don't free async event's 'data' The monitor_protocol_event() function will free the event's data, this is wrong as 'data' management is up to the caller. Signed-off-by: Luiz Capitulino Signed-off-by: Anthony Liguori --- monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index 3af1d5c782..2403a979e4 100644 --- a/monitor.c +++ b/monitor.c @@ -365,8 +365,10 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) qmp = qdict_new(); timestamp_put(qmp); qdict_put(qmp, "event", qstring_from_str(event_name)); - if (data) + if (data) { + qobject_incref(data); qdict_put_obj(qmp, "data", data); + } monitor_json_emitter(mon, QOBJECT(qmp)); QDECREF(qmp);