]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/lib/dbwrap: clang: Fix 'Access to field results in a deref of a null'
authorNoel Power <noel.power@suse.com>
Tue, 9 Jul 2019 14:42:46 +0000 (14:42 +0000)
committerGary Lockyer <gary@samba.org>
Wed, 24 Jul 2019 21:33:20 +0000 (21:33 +0000)
Fixes:

source3/lib/dbwrap/dbwrap_ctdb.c:530:39: warning: Access to field 'm_write' results in a dereference of a null pointer (loaded from field 'transaction') <--[clang]
        if (pull_newest_from_marshall_buffer(ctx->transaction->m_write, key,

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source3/lib/dbwrap/dbwrap_ctdb.c

index 33558e442f3b4bd4a7a193e276d565cae06dec55..0e108920f585acbd4e210e1a7ea3b5afccb0638d 100644 (file)
@@ -527,6 +527,11 @@ static struct db_record *db_ctdb_fetch_locked_transaction(struct db_ctdb_ctx *ct
        result->storev = db_ctdb_storev_transaction;
        result->delete_rec = db_ctdb_delete_transaction;
 
+       if (ctx->transaction == NULL) {
+               DEBUG(0, ("no transaction available\n"));
+               TALLOC_FREE(result);
+               return NULL;
+       }
        if (pull_newest_from_marshall_buffer(ctx->transaction->m_write, key,
                                             NULL, result, &result->value)) {
                return result;