From patchwork Fri Jan 8 18:45:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 42532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 746D31007D1 for ; Sat, 9 Jan 2010 05:57:16 +1100 (EST) Received: from localhost ([127.0.0.1]:37837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTK1J-0006RI-Ms for incoming@patchwork.ozlabs.org; Fri, 08 Jan 2010 13:57:13 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NTJqY-0004da-8V for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:46:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NTJqT-0004WD-9q for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:46:05 -0500 Received: from [199.232.76.173] (port=54469 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTJqS-0004Vl-VM for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:46:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63813) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NTJqS-0000P4-6t for qemu-devel@nongnu.org; Fri, 08 Jan 2010 13:46:00 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o08IjwoX013185 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Jan 2010 13:45:59 -0500 Received: from doriath (vpn-9-144.rdu.redhat.com [10.11.9.144]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o08IjtuD029722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 8 Jan 2010 13:45:57 -0500 Date: Fri, 8 Jan 2010 16:45:53 -0200 From: Luiz Capitulino To: qemu-devel@nongnu.org Message-ID: <20100108164553.0ad0fb5d@doriath> Organization: Red Hat Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH] QMP: Don't free async event's 'data' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- monitor.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index 3af1d5c..2403a97 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);