From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViR6j-0003sB-8j for qemu-devel@nongnu.org; Mon, 18 Nov 2013 10:51:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ViR6d-00015s-9e for qemu-devel@nongnu.org; Mon, 18 Nov 2013 10:51:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViR6d-00015b-0O for qemu-devel@nongnu.org; Mon, 18 Nov 2013 10:51:19 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAIFpHtD004201 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Nov 2013 10:51:18 -0500 Message-ID: <528A3774.5070201@redhat.com> Date: Mon, 18 Nov 2013 10:51:16 -0500 From: Vlad Yasevich MIME-Version: 1.0 References: <1384788737-6233-1-git-send-email-akong@redhat.com> In-Reply-To: <1384788737-6233-1-git-send-email-akong@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] virtio-net: fix the memory leak in rxfilter_notify() Reply-To: vyasevic@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong , qemu-devel@nongnu.org Cc: stefanha@redhat.com, mst@redhat.com On 11/18/2013 10:32 AM, Amos Kong wrote: > object_get_canonical_path() returns a gchar*, it should be freeed by the > caller. > > Signed-off-by: Amos Kong Reviewed-by: Vlad Yasevich -vlad > --- > v2: put gchar *path inside rxfilter_notify_enabled block > --- > hw/net/virtio-net.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 613f144..b75c753 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -200,16 +200,16 @@ static void rxfilter_notify(NetClientState *nc) > VirtIONet *n = qemu_get_nic_opaque(nc); > > if (nc->rxfilter_notify_enabled) { > + gchar *path = object_get_canonical_path(OBJECT(n->qdev)); > if (n->netclient_name) { > event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }", > - n->netclient_name, > - object_get_canonical_path(OBJECT(n->qdev))); > + n->netclient_name, path); > } else { > - event_data = qobject_from_jsonf("{ 'path': %s }", > - object_get_canonical_path(OBJECT(n->qdev))); > + event_data = qobject_from_jsonf("{ 'path': %s }", path); > } > monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data); > qobject_decref(event_data); > + g_free(path); > > /* disable event notification to avoid events flooding */ > nc->rxfilter_notify_enabled = 0; >