[dpdk-stable] [PATCH] net/virtio: fix getline memory leakage

Xia, Chenbo chenbo.xia at intel.com
Wed Apr 28 05:21:16 CEST 2021


> -----Original Message-----
> From: stable <stable-bounces at dpdk.org> On Behalf Of Xia, Chenbo
> Sent: Wednesday, April 21, 2021 10:10 AM
> To: Min Hu (Connor) <humin29 at huawei.com>; dev at dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit at intel.com>; maxime.coquelin at redhat.com;
> stable at dpdk.org
> Subject: Re: [dpdk-stable] [PATCH] net/virtio: fix getline memory leakage
> 
> > -----Original Message-----
> > From: Min Hu (Connor) <humin29 at huawei.com>
> > Sent: Wednesday, April 21, 2021 9:38 AM
> > To: dev at dpdk.org
> > Cc: Yigit, Ferruh <ferruh.yigit at intel.com>; maxime.coquelin at redhat.com; Xia,
> > Chenbo <chenbo.xia at intel.com>
> > Subject: [PATCH] net/virtio: fix getline memory leakage
> >
> > From: Chengwen Feng <fengchengwen at huawei.com>
> >
> > This patch fixes getline memory leakage when parsing dynamic major num.
> >
> > Fixes: 7d62bf6f54ba ("net/virtio: introduce vhost-vDPA backend type")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> > Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
> > ---
> >  drivers/net/virtio/virtio_user_ethdev.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> > b/drivers/net/virtio/virtio_user_ethdev.c
> > index 79bd31e..e85906e 100644
> > --- a/drivers/net/virtio/virtio_user_ethdev.c
> > +++ b/drivers/net/virtio/virtio_user_ethdev.c
> > @@ -360,7 +360,7 @@ vdpa_dynamic_major_num(void)
> >  {
> >  	FILE *fp;
> >  	char *line = NULL;
> > -	size_t size;
> > +	size_t size = 0;
> >  	char name[11];
> >  	bool found = false;
> >  	uint32_t num;
> > @@ -380,6 +380,7 @@ vdpa_dynamic_major_num(void)
> >  			break;
> >  		}
> >  	}
> > +	free(line);
> >  	fclose(fp);
> >  	return found ? num : UNNAMED_MAJOR;
> >  }
> > --
> > 2.7.4

Applied to next-virtio/main, thanks


More information about the stable mailing list