> -----Original Message----- > From: stable <[email protected]> On Behalf Of Xia, Chenbo > Sent: Wednesday, April 21, 2021 10:10 AM > To: Min Hu (Connor) <[email protected]>; [email protected] > Cc: Yigit, Ferruh <[email protected]>; [email protected]; > [email protected] > Subject: Re: [dpdk-stable] [PATCH] net/virtio: fix getline memory leakage > > > -----Original Message----- > > From: Min Hu (Connor) <[email protected]> > > Sent: Wednesday, April 21, 2021 9:38 AM > > To: [email protected] > > Cc: Yigit, Ferruh <[email protected]>; [email protected]; Xia, > > Chenbo <[email protected]> > > Subject: [PATCH] net/virtio: fix getline memory leakage > > > > From: Chengwen Feng <[email protected]> > > > > This patch fixes getline memory leakage when parsing dynamic major num. > > > > Fixes: 7d62bf6f54ba ("net/virtio: introduce vhost-vDPA backend type") > > Cc: [email protected] > > > > Signed-off-by: Chengwen Feng <[email protected]> > > Signed-off-by: Min Hu (Connor) <[email protected]> > > --- > > 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

