dbwrap_tdb: Avoid double-call to talloc_get_type_abort
authorVolker Lendecke <vl@samba.org>
Thu, 16 Aug 2018 11:18:14 +0000 (13:18 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 14 Sep 2018 05:49:13 +0000 (07:49 +0200)
We've already retrieved "ctx" in the callers of db_tdb_fetch_locked_internal().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
lib/dbwrap/dbwrap_tdb.c

index d695f3bd732e7e6f636dac9236263c2d690a0734..00d283c66e6c6ea0e7b6487f25fcb3bb373681a4 100644 (file)
@@ -111,10 +111,11 @@ static int db_tdb_fetchlock_parse(TDB_DATA key, TDB_DATA data,
 }
 
 static struct db_record *db_tdb_fetch_locked_internal(
-       struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key)
+       struct db_context *db,
+       struct db_tdb_ctx *ctx,
+       TALLOC_CTX *mem_ctx,
+       TDB_DATA key)
 {
-       struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
-                                                      struct db_tdb_ctx);
        struct tdb_fetch_locked_state state;
        int ret;
 
@@ -162,7 +163,7 @@ static struct db_record *db_tdb_fetch_locked(
                DEBUG(3, ("tdb_chainlock failed\n"));
                return NULL;
        }
-       return db_tdb_fetch_locked_internal(db, mem_ctx, key);
+       return db_tdb_fetch_locked_internal(db, ctx, mem_ctx, key);
 }
 
 static struct db_record *db_tdb_try_fetch_locked(
@@ -176,7 +177,7 @@ static struct db_record *db_tdb_try_fetch_locked(
                DEBUG(3, ("tdb_chainlock_nonblock failed\n"));
                return NULL;
        }
-       return db_tdb_fetch_locked_internal(db, mem_ctx, key);
+       return db_tdb_fetch_locked_internal(db, ctx, mem_ctx, key);
 }
 
 static NTSTATUS db_tdb_do_locked(struct db_context *db, TDB_DATA key,