Skip to content

Commit

Permalink
net/virtio: fix getline memory leakage
Browse files Browse the repository at this point in the history
[ upstream commit 9f52837 ]

This patch fixes getline memory leakage when parsing dynamic major num.

Fixes: 7d62bf6 ("net/virtio: introduce vhost-vDPA backend type")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
  • Loading branch information
fengchengwen authored and steevenlee committed Jun 8, 2021
1 parent 24743b7 commit 0f04694
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/virtio/virtio_user_ethdev.c
Expand Up @@ -584,7 +584,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;
Expand All @@ -604,6 +604,7 @@ vdpa_dynamic_major_num(void)
break;
}
}
free(line);
fclose(fp);
return found ? num : UNNAMED_MAJOR;
}
Expand Down

0 comments on commit 0f04694

Please sign in to comment.