qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: Vlad Yasevich <vyasevic@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] net: move rxfilter_notify() to net.c
Date: Mon, 18 Nov 2013 20:59:46 +0800	[thread overview]
Message-ID: <20131118125946.GA20192@amosk.info> (raw)
In-Reply-To: <52865097.1050505@redhat.com>

On Fri, Nov 15, 2013 at 11:49:27AM -0500, Vlad Yasevich wrote:
> On 11/15/2013 10:27 AM, Stefan Hajnoczi wrote:
> >On Tue, Nov 05, 2013 at 07:00:48PM +0800, Amos Kong wrote:
> >>@@ -545,7 +523,7 @@ static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
> >>          return VIRTIO_NET_ERR;
> >>      }
> >>
> >>-    rxfilter_notify(nc);
> >>+    rxfilter_notify(nc, object_get_canonical_path(OBJECT(n->qdev)));
> >>
> >>      return VIRTIO_NET_OK;
> >>  }
> >[...]
> >>diff --git a/net/net.c b/net/net.c
> >>index c330c9a..f41a457 100644
> >>--- a/net/net.c
> >>+++ b/net/net.c
> >>@@ -40,6 +40,7 @@
> >>  #include "qapi-visit.h"
> >>  #include "qapi/opts-visitor.h"
> >>  #include "qapi/dealloc-visitor.h"
> >>+#include "qapi/qmp/qjson.h"
> >>
> >>  /* Net bridge is currently not supported for W32. */
> >>  #if !defined(_WIN32)
> >>@@ -962,6 +963,25 @@ void print_net_client(Monitor *mon, NetClientState *nc)
> >>                     nc->info_str);
> >>  }
> >>
> >>+void rxfilter_notify(NetClientState *nc, const char *path)
> >>+{
> >>+    QObject *event_data;
> >>+
> >>+    if (nc->rxfilter_notify_enabled) {
> >>+        if (nc->name) {
> >>+            event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }",
> >>+					    nc->name, path);
> >>+        } else {
> >>+            event_data = qobject_from_jsonf("{ 'path': %s }", path);
> >>+        }
> >>+        monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data);
> >>+        qobject_decref(event_data);
> >>+
> >>+        /* disable event notification to avoid events flooding */
> >>+        nc->rxfilter_notify_enabled = 0;
> >>+    }
> >>+}
> >
> >Please fix the memory leak:
> >object_get_canonical_path() returns a gchar* that the caller must free.

> Wow, this memory leak is all over the place and not just in this patch.

Yes, my v2 fix the memory leak in rxfilter_notify().
I just check the code, your patch fixed _the last_ leak
of object_get_canonical_path(). Thanks.
 
> -vlad

-- 
			Amos.

      reply	other threads:[~2013-11-18 13:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 11:00 [Qemu-devel] [PATCH] net: move rxfilter_notify() to net.c Amos Kong
2013-11-15 15:27 ` Stefan Hajnoczi
2013-11-15 16:49   ` Vlad Yasevich
2013-11-18 12:59     ` Amos Kong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131118125946.GA20192@amosk.info \
    --to=akong@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vyasevic@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).