Blame SOURCES/e2fsprogs-1.45.6-tdb_transaction_recover-fix-memory-leak.patch

f239de
From a6f7be73206a27f6b5eb95ed66095d38110560cc Mon Sep 17 00:00:00 2001
f239de
From: wuguanghao <wuguanghao3@huawei.com>
f239de
Date: Wed, 30 Jun 2021 16:27:14 +0800
f239de
Subject: [PATCH 27/46] tdb_transaction_recover: fix memory leak
f239de
Content-Type: text/plain
f239de
f239de
In tdb_transaction_recover(), need free data before return,
f239de
otherwise it will cause memory leak.
f239de
f239de
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
f239de
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
f239de
Reviewed-by: Wu Bo <wubo40@huawei.com>
f239de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
f239de
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
f239de
---
f239de
 lib/ext2fs/tdb.c | 1 +
f239de
 1 file changed, 1 insertion(+)
f239de
f239de
diff --git a/lib/ext2fs/tdb.c b/lib/ext2fs/tdb.c
f239de
index 5091b128..0fb94815 100644
f239de
--- a/lib/ext2fs/tdb.c
f239de
+++ b/lib/ext2fs/tdb.c
f239de
@@ -2186,6 +2186,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
f239de
 				   rec.data_len, 0) == -1) {
f239de
 		TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery data\n"));
f239de
 		tdb->ecode = TDB_ERR_IO;
f239de
+		free(data);
f239de
 		return -1;
f239de
 	}
f239de
 
f239de
-- 
f239de
2.35.1
f239de