qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Eugenio Pérez" <eperezma@redhat.com>
Cc: qemu-trivial@nongnu.org, Jason Wang <jasowang@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/1] vdpa: Make ncs autofree
Date: Wed, 16 Feb 2022 09:41:49 +0100	[thread overview]
Message-ID: <20220216084149.c7clj3nhlsxposp6@sgarzare-redhat> (raw)
In-Reply-To: <20220214193415.1606752-2-eperezma@redhat.com>

On Mon, Feb 14, 2022 at 08:34:15PM +0100, Eugenio Pérez wrote:
>Simplifying memory management.
>
>Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>---
> net/vhost-vdpa.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
>index 4125d13118..4befba5cc7 100644
>--- a/net/vhost-vdpa.c
>+++ b/net/vhost-vdpa.c
>@@ -264,7 +264,8 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> {
>     const NetdevVhostVDPAOptions *opts;
>     int vdpa_device_fd;
>-    NetClientState **ncs, *nc;
>+    g_autofree NetClientState **ncs = NULL;
>+    NetClientState *nc;
>     int queue_pairs, i, has_cvq = 0;
>
>     assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
>@@ -302,7 +303,6 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
>             goto err;
>     }
>
>-    g_free(ncs);
>     return 0;
>
> err:
>@@ -310,7 +310,6 @@ err:
>         qemu_del_net_client(ncs[0]);
>     }
>     qemu_close(vdpa_device_fd);
>-    g_free(ncs);
>
>     return -1;
> }
>-- 
>2.27.0
>
>



  parent reply	other threads:[~2022-02-16  9:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 19:34 [PATCH 0/1] vdpa: Make ncs autofree Eugenio Pérez
2022-02-14 19:34 ` [PATCH 1/1] " Eugenio Pérez
2022-02-14 22:14   ` Philippe Mathieu-Daudé via
2022-02-15  3:04   ` Jason Wang
2022-02-16  8:41   ` Stefano Garzarella [this message]
2022-02-22  0:34   ` Laurent Vivier

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=20220216084149.c7clj3nhlsxposp6@sgarzare-redhat \
    --to=sgarzare@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).