DPDK patches and discussions
 help / color / mirror / Atom feed
From: RickZhong <winsome8282@163.com>
To: dev@dpdk.org
Cc: RickZhong <winsome8282@163.com>
Subject: [dpdk-dev] [PATCH] mem: fix mem leak issue when attaching a PCI device without driver to DPDK
Date: Mon, 28 Jun 2021 17:02:49 +0800	[thread overview]
Message-ID: <20210628090249.70873-1-winsome8282@163.com> (raw)

when trying to attach a PCI device without driver to DPDK,
the 'dev' is malloced but not freed.

Signed-off-by: RickZhong <winsome8282@163.com>
---
 drivers/bus/pci/linux/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 0dc99e9cb..909502ecc 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -332,6 +332,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
 		dev->kdrv = RTE_PCI_KDRV_NONE;
+		free(dev);
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
-- 
2.18.4



             reply	other threads:[~2021-06-28  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28  9:02 RickZhong [this message]
2021-06-28  9:25 ` David Marchand

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=20210628090249.70873-1-winsome8282@163.com \
    --to=winsome8282@163.com \
    --cc=dev@dpdk.org \
    /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).