[PATCH] btt: fix potential memory leak problem in io_free_all()
songkai <[email protected]>
| Newsgroups | org.kernel.vger.linux-btrace |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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