From f74d565ff8a2eb771c58efba464caa6f785b0122 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 23 Jul 2021 09:53:37 +0200 Subject: [PATCH] Fix memory leak on transaction error resolves: rhbz#1938798 --- libtdb-fix-memleak-on-transaction-error.patch | 28 +++++++++++++++++++ libtdb.spec | 5 ++++ 2 files changed, 33 insertions(+) create mode 100644 libtdb-fix-memleak-on-transaction-error.patch diff --git a/libtdb-fix-memleak-on-transaction-error.patch b/libtdb-fix-memleak-on-transaction-error.patch new file mode 100644 index 0000000..7a03cb3 --- /dev/null +++ b/libtdb-fix-memleak-on-transaction-error.patch @@ -0,0 +1,28 @@ +From 252275f3a6b5d81d23ca0eb35bcb67c2d01dd807 Mon Sep 17 00:00:00 2001 +From: Andreas Schneider +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 +Reviewed-by: Stefan Metzmacher +--- + 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 + diff --git a/libtdb.spec b/libtdb.spec index 5e06ea3..37dda98 100644 --- a/libtdb.spec +++ b/libtdb.spec @@ -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 - 1.4.3-9 +- resolves: rhbz#1938798 - Fix memory leak on transaction error + * Mon May 31 2021 Andreas Schneider - 1.4.3-8 - related: rhbz#1962774 - Rebuilt for running gating tests