summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/common
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-08 07:20:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:37 -0500
commit1562ecf221d9f5f591e344d6e5c6f19e802b089e (patch)
treeaee0f1da7b65cc3fbdc67724ef2d03483c5733a7 /source4/lib/tdb/common
parentdb45433f312fd03c58c9c9b3a924852700ef6113 (diff)
downloadsamba-1562ecf221d9f5f591e344d6e5c6f19e802b089e.tar.gz
samba-1562ecf221d9f5f591e344d6e5c6f19e802b089e.tar.bz2
samba-1562ecf221d9f5f591e344d6e5c6f19e802b089e.zip
r14029: Fix resource leak in error codepath. Coverity CID #64.
Jeremy. (This used to be commit d2e9d5b34baee90060ee9131b3da903309625a56)
Diffstat (limited to 'source4/lib/tdb/common')
-rw-r--r--source4/lib/tdb/common/traverse.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c
index dc1060c6d0..4792af1122 100644
--- a/source4/lib/tdb/common/traverse.c
+++ b/source4/lib/tdb/common/traverse.c
@@ -289,10 +289,14 @@ TDB_DATA tdb_nextkey(struct 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 (tdb_unlock_record(tdb, tdb->travlocks.off) != 0)
+ if (tdb_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;
}