aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwuguanghao <wuguanghao3@huawei.com>2021-06-30 16:27:14 +0800
committerTheodore Ts'o <tytso@mit.edu>2021-07-15 23:19:26 -0400
commit1b673e44c169994bf91b31a431e72ae0692549c1 (patch)
treeaeb27e980b70d0236c31cc43c1a6c6ce588aa222
parentcac906a942f41b9b8515b10877d3e0b23ef548a9 (diff)
downloade2fsprogs-1b673e44c169994bf91b31a431e72ae0692549c1.tar.gz
tdb_transaction_recover: fix memory leak
In tdb_transaction_recover(), need free data before return, otherwise it will cause memory leak. Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Reviewed-by: Wu Bo <wubo40@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/ext2fs/tdb.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/ext2fs/tdb.c b/lib/ext2fs/tdb.c
index 5091b128b..0fb948158 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;
}