diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-08-30 06:56:12 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-08-30 06:56:12 +0000 |
commit | a6ace770eb9b11271803215f218bf772fa7d9faa (patch) | |
tree | 1498f564778dd99bb854500cc48fdc00dc92d844 /source3/tdb/tdb.c | |
parent | 1e8fa8cbb1197808965c627aa288e7db46736e77 (diff) | |
download | samba-a6ace770eb9b11271803215f218bf772fa7d9faa.tar.gz samba-a6ace770eb9b11271803215f218bf772fa7d9faa.tar.bz2 samba-a6ace770eb9b11271803215f218bf772fa7d9faa.zip |
ensure that we unlock in case we hit a tdb error
(This used to be commit 4aa7dfb7e7f4ad33b8768d20ec2eb9cb3fde6385)
Diffstat (limited to 'source3/tdb/tdb.c')
-rw-r--r-- | source3/tdb/tdb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c index ed75a55e3e..40e7dcd42c 100644 --- a/source3/tdb/tdb.c +++ b/source3/tdb/tdb.c @@ -517,17 +517,20 @@ int tdb_printfreelist(TDB_CONTEXT *tdb) /* read in the freelist top */ if (ofs_read(tdb, offset, &rec_ptr) == -1) { + tdb_unlock(tdb, -1, F_WRLCK); return 0; } printf("freelist top=[0x%08x]\n", rec_ptr ); while (rec_ptr) { if (tdb_read(tdb, rec_ptr, (char *)&rec, sizeof(rec), DOCONV()) == -1) { + tdb_unlock(tdb, -1, F_WRLCK); return -1; } if (rec.magic != TDB_FREE_MAGIC) { printf("bad magic 0x%08x in free list\n", rec.magic); + tdb_unlock(tdb, -1, F_WRLCK); return -1; } |