From: songkai <songkai01@inspur.com>
To: linux-btrace@vger.kernel.org
Subject: [PATCH] btt: fix potential memory leak problem in io_free_all()
Date: Fri, 17 Sep 2021 09:18:45 +0000 [thread overview]
Message-ID: <20210917091845.133913-1-songkai01@inspur.com> (raw)
In “struct io” , the "void *pdu" member points to the memory
which is allocated in convert_to_cpu(). We should free memory
pdu point to before we free "struct io", or memory leak occurred.
Signed-off-by: songkai <songkai01@inspur.com>
---
btt/inlines.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/btt/inlines.h b/btt/inlines.h
index 64b5a2c..fa5a546 100644
--- a/btt/inlines.h
+++ b/btt/inlines.h
@@ -153,6 +153,9 @@ static inline void io_free_all(void)
list_for_each_safe(p, q, &all_ios) {
iop = list_entry(p, struct io, a_head);
+
+ if (iop->pdu)
+ free(iop->pdu);
free(iop);
}
}
--
2.27.0
next reply other threads:[~2021-09-17 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 9:18 songkai [this message]
2021-09-20 18:08 ` [PATCH] btt: fix potential memory leak problem in io_free_all() Jeff Moyer
2021-09-23 1:02 ` Harris song (宋凯)-浪潮信息
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=20210917091845.133913-1-songkai01@inspur.com \
--to=songkai01@inspur.com \
--cc=linux-btrace@vger.kernel.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 read-only IMAP folder(s) and NNTP newsgroup(s).