[PATCH] btt: fix potential memory leak problem in io_free_all()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux