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

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