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

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