vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs()
PATCH 1/1 vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs()
Reported by Coverity (CID 1465228).
Fixes 402378407dbdce79ce745a13f5c84815f929cfdd ("vhost-vdpa: multiqueue support")
Cc Jason Wang <[email protected]>
Signed-off-by Stefan Hajnoczi <[email protected]>
--- net/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/vhost-vdpa.c +1 -1
@@ -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;
Signature · 1 line
2.31.1
Quoted 15 lines · Stefan Hajnoczi
Reported by Coverity (CID 1465228).
Fixes 402378407dbdce79ce745a13f5c84815f929cfdd ("vhost-vdpa: multiqueue support")Cc Jason Wang <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>--- net/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/vhost-vdpa.c +0
-0
net/vhost-vdpa.c static NetClientState *net_vhost_vdpa_init(NetClientState *peer, · line 220
Quoted 8 lines
net/vhost-vdpa.c +1
-1@@ -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/[email protected]/