Fixed crash bug when calling tdb_unlockkeys() with no locked keys.
authorTim Potter <tpot@samba.org>
Thu, 13 Mar 2003 05:52:49 +0000 (05:52 +0000)
committerTim Potter <tpot@samba.org>
Thu, 13 Mar 2003 05:52:49 +0000 (05:52 +0000)
woot!
(This used to be commit eb432700c0010e536be3a0703f152c533357b851)

source3/tdb/tdb.c

index ab50f40ef6ec4adfba693b2242879ec815c19317..c414ae0d3108ccaf12aa9165d171d14bc8127a90 100644 (file)
@@ -1954,6 +1954,8 @@ int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[])
 void tdb_unlockkeys(TDB_CONTEXT *tdb)
 {
        u32 i;
+       if (!tdb->lockedkeys)
+               return;
        for (i = 0; i < tdb->lockedkeys[0]; i++)
                tdb_unlock(tdb, tdb->lockedkeys[i+1], F_WRLCK);
        SAFE_FREE(tdb->lockedkeys);