All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btt: fix potential memory leak problem in io_free_all()
@ 2021-09-17  9:18 songkai
  2021-09-20 18:08 ` Jeff Moyer
  2021-09-23  1:02 ` Harris song (宋凯)-浪潮信息
  0 siblings, 2 replies; 3+ messages in thread
From: songkai @ 2021-09-17  9:18 UTC (permalink / raw)
  To: linux-btrace

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-23  1:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17  9:18 [PATCH] btt: fix potential memory leak problem in io_free_all() songkai
2021-09-20 18:08 ` Jeff Moyer
2021-09-23  1:02 ` Harris song (宋凯)-浪潮信息

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.