All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevic@redhat.com>
To: Amos Kong <akong@redhat.com>, qemu-devel@nongnu.org
Cc: stefanha@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] virtio-net: fix the memory leak in rxfilter_notify()
Date: Mon, 18 Nov 2013 10:51:16 -0500	[thread overview]
Message-ID: <528A3774.5070201@redhat.com> (raw)
In-Reply-To: <1384788737-6233-1-git-send-email-akong@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 <akong@redhat.com>

Reviewed-by: Vlad Yasevich <vyasevic@redhat.com>

-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;
> 

  parent reply	other threads:[~2013-11-18 15:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 15:32 [Qemu-devel] [PATCH v2] virtio-net: fix the memory leak in rxfilter_notify() Amos Kong
2013-11-18 15:44 ` Michael S. Tsirkin
2013-11-18 15:51 ` Vlad Yasevich [this message]
2013-11-18 15:59 ` Andreas Färber
2013-11-19  8:46 ` Stefan Hajnoczi

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=528A3774.5070201@redhat.com \
    --to=vyasevic@redhat.com \
    --cc=akong@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.