Skip to contentSkip to conversation

QMP: Don't free async event's 'data'

PATCH Applied Luiz Capitulino 2 participants 2 messages Jan 8, 2010 – Jan 12, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 monitor.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
monitor.c +3 -1
index 3af1d5c..2403a97 100644
@@ -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);
Signature · 1 line
1.6.6
#1 lore raw
Quoted 6 lines · Luiz Capitulino

The monitor_protocol_event() function will free the event's data, this is wrong as 'data' management is up to the caller.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 21 lines
---
  monitor.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
monitor.c +3 -1
index 3af1d5c..2403a97 100644
@@ -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);