Fix memory leak on transaction error

resolves: rhbz#1938798
This commit is contained in:
Andreas Schneider 2021-07-23 09:53:37 +02:00
parent da42d606e0
commit f74d565ff8
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From 252275f3a6b5d81d23ca0eb35bcb67c2d01dd807 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Wed, 7 Jul 2021 11:12:37 +0200
Subject: [PATCH] lib:tdb: Fix a memory leak on error
Found by covscan.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
---
lib/tdb/common/transaction.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c
index 4f8d1f8cdcc..5ab38d0809f 100644
--- a/common/transaction.c
+++ b/common/transaction.c
@@ -1301,6 +1301,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;
}
--
GitLab

View File

@ -15,6 +15,8 @@ Source2: tdb.keyring
# Patches
Patch0001: 0003-wafsamba-Fix-few-SyntaxWarnings-caused-by-regular-ex.patch
# https://gitlab.com/samba-team/samba/-/commit/252275f3a6b5d81d23ca0eb35bcb67c2d01dd807.patch
Patch0002: libtdb-fix-memleak-on-transaction-error.patch
BuildRequires: make
BuildRequires: gcc
@ -101,6 +103,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
%ldconfig_scriptlets
%changelog
* Fri Jul 23 2021 Andreas Schneider <asn@redhat.com> - 1.4.3-9
- resolves: rhbz#1938798 - Fix memory leak on transaction error
* Mon May 31 2021 Andreas Schneider <asn@redhat.com> - 1.4.3-8
- related: rhbz#1962774 - Rebuilt for running gating tests