From: Chengwen Feng Date: Wed, 21 Apr 2021 01:37:49 +0000 (+0800) Subject: net/virtio: fix getline memory leakage X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9f528374bffb5868ec6bf896f57919a709b31911;p=dpdk.git net/virtio: fix getline memory leakage This patch fixes getline memory leakage when parsing dynamic major num. Fixes: 7d62bf6f54ba ("net/virtio: introduce vhost-vDPA backend type") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) Reviewed-by: Chenbo Xia --- diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 79bd31ed82..e85906e9eb 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; }