Thread (20 messages) 20 messages, 3 authors, 2021-05-29
STALE1839d REVIEWED: 1 (0M)

[PATCH 02/12] tdb_transaction_recover: fix memory leak

From: Wu Guanghao <hidden>
Date: 2021-05-24 11:20:25
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

In tdb_transaction_recover(), need free data before return,
otherwise it will cause memory leak.

Signed-off-by: Wu Guanghao <redacted>
Signed-off-by: Zhiqiang Liu <redacted>
Reviewed-by: Wu Bo <redacted>
---
 lib/ext2fs/tdb.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/lib/ext2fs/tdb.c b/lib/ext2fs/tdb.c
index 5091b128..ddfcf130 100644
--- a/lib/ext2fs/tdb.c
+++ b/lib/ext2fs/tdb.c
@@ -2186,6 +2186,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
 				   rec.data_len, 0) == -1) {
 		TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery data\n"));
 		tdb->ecode = TDB_ERR_IO;
+		free(data);
 		return -1;
 	}
-- 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help