summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-08 07:20:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:11:06 -0500
commit8f0bdb9c4ede5e953904cfc528c57886f9de2bdb (patch)
treedd7f55ada5e448fb35f6c5b696d4624d4e1ec68a /source3
parent6b591819dd64dfd4001b954a000716730a89b2f6 (diff)
downloadsamba-8f0bdb9c4ede5e953904cfc528c57886f9de2bdb.tar.gz
samba-8f0bdb9c4ede5e953904cfc528c57886f9de2bdb.tar.bz2
samba-8f0bdb9c4ede5e953904cfc528c57886f9de2bdb.zip
r14030: Fix resource leak in error codepath. Coverity CID #64.
Jeremy. (This used to be commit b51edde4d63e9b2f241f41b6780b026487890a7f)
Diffstat (limited to 'source3')
-rw-r--r--source3/tdb/tdb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index f07f474716..4303976087 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -1458,10 +1458,14 @@ TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA oldkey)
rec.key_len))
|| memcmp(k, oldkey.dptr, oldkey.dsize) != 0) {
/* No, it wasn't: unlock it and start from scratch */
- if (unlock_record(tdb, tdb->travlocks.off) != 0)
+ if (unlock_record(tdb, tdb->travlocks.off) != 0) {
+ SAFE_FREE(k);
return tdb_null;
- if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0)
+ }
+ if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0) {
+ SAFE_FREE(k);
return tdb_null;
+ }
tdb->travlocks.off = 0;
}