Received: from eggs.gnu.org ([2001:4830:134:3::10]:49465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vikd2-00059c-QX for qemu-devel@nongnu.org; Tue, 19 Nov 2013 07:42:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vikcx-0006rA-M4 for qemu-devel@nongnu.org; Tue, 19 Nov 2013 07:42:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:3250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vikcx-0006qx-CV for qemu-devel@nongnu.org; Tue, 19 Nov 2013 07:41:59 -0500 From: Stefan Hajnoczi Date: Tue, 19 Nov 2013 13:41:48 +0100 Message-Id: <1384864908-29868-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1384864908-29868-1-git-send-email-stefanha@redhat.com> References: <1384864908-29868-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-1.7 2/2] virtio-net: fix the memory leak in rxfilter_notify() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amos Kong , Stefan Hajnoczi , Anthony Liguori From: Amos Kong object_get_canonical_path() returns a gchar*, it should be freed by the caller. Signed-off-by: Amos Kong Reviewed-by: Michael S. Tsirkin Reviewed-by: Vlad Yasevich Reviewed-by: Andreas F=C3=A4rber Signed-off-by: Stefan Hajnoczi --- 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 =3D qemu_get_nic_opaque(nc); =20 if (nc->rxfilter_notify_enabled) { + gchar *path =3D object_get_canonical_path(OBJECT(n->qdev)); if (n->netclient_name) { event_data =3D qobject_from_jsonf("{ 'name': %s, 'path': %s = }", - n->netclient_name, - object_get_canonical_path(OBJECT(n->= qdev))); + n->netclient_name, path); } else { - event_data =3D qobject_from_jsonf("{ 'path': %s }", - object_get_canonical_path(OBJECT(n->= qdev))); + event_data =3D qobject_from_jsonf("{ 'path': %s }", path); } monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data)= ; qobject_decref(event_data); + g_free(path); =20 /* disable event notification to avoid events flooding */ nc->rxfilter_notify_enabled =3D 0; --=20 1.8.4.2