All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs()
@ 2021-11-02 16:39 Stefan Hajnoczi
  2021-11-02 17:51 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2021-11-02 16:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jason Wang, Stefan Hajnoczi

Reported by Coverity (CID 1465228).

Fixes: 402378407dbdce79ce745a13f5c84815f929cfdd ("vhost-vdpa: multiqueue support")
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 net/vhost-vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 49ab322511..373b706b90 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -214,7 +214,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
 static int vhost_vdpa_get_max_queue_pairs(int fd, int *has_cvq, Error **errp)
 {
     unsigned long config_size = offsetof(struct vhost_vdpa_config, buf);
-    struct vhost_vdpa_config *config;
+    g_autofree struct vhost_vdpa_config *config = NULL;
     __virtio16 *max_queue_pairs;
     uint64_t features;
     int ret;
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs()
  2021-11-02 16:39 [PATCH] vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs() Stefan Hajnoczi
@ 2021-11-02 17:51 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-02 17:51 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Jason Wang, Stefano Garzarella

On 11/2/21 17:39, Stefan Hajnoczi wrote:
> Reported by Coverity (CID 1465228).
> 
> Fixes: 402378407dbdce79ce745a13f5c84815f929cfdd ("vhost-vdpa: multiqueue support")
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  net/vhost-vdpa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 49ab322511..373b706b90 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -214,7 +214,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
>  static int vhost_vdpa_get_max_queue_pairs(int fd, int *has_cvq, Error **errp)
>  {
>      unsigned long config_size = offsetof(struct vhost_vdpa_config, buf);
> -    struct vhost_vdpa_config *config;
> +    g_autofree struct vhost_vdpa_config *config = NULL;
>      __virtio16 *max_queue_pairs;
>      uint64_t features;
>      int ret;
> 

Stefano sent the same fix few minutes before you ;)
https://lore.kernel.org/qemu-devel/20211102155157.241034-1-sgarzare@redhat.com/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-02 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 16:39 [PATCH] vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs() Stefan Hajnoczi
2021-11-02 17:51 ` Philippe Mathieu-Daudé

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.