lib:tdb: Fix a memory leak on error
authorAndreas Schneider <asn@samba.org>
Wed, 7 Jul 2021 09:12:37 +0000 (11:12 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 8 Jul 2021 09:30:40 +0000 (09:30 +0000)
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/common/transaction.c

index 4f8d1f8cdccc5d4723a4c7d7e76c8c54a31a7256..5ab38d0809f29264ea7e69afaa68423705bb8c63 100644 (file)
@@ -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;
        }