From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <maxime.coquelin@redhat.com>,
<chenbo.xia@intel.com>
Subject: [dpdk-dev] [PATCH] net/virtio: fix getline memory leakage
Date: Wed, 21 Apr 2021 09:37:49 +0800 [thread overview]
Message-ID: <1618969069-15304-1-git-send-email-humin29@huawei.com> (raw)
From: Chengwen Feng <fengchengwen@huawei.com>
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 <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@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
next reply other threads:[~2021-04-21 1:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 1:37 Min Hu (Connor) [this message]
2021-04-21 2:10 ` Xia, Chenbo
2021-04-28 3:21 ` Xia, Chenbo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1618969069-15304-1-git-send-email-humin29@huawei.com \
--to=humin29@huawei.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=maxime.coquelin@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).