From 637cd1a6c4175c527caa144767f3543156c66ed5 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Tue, 9 Jul 2019 14:42:46 +0000 Subject: [PATCH] s3/lib/dbwrap: clang: Fix 'Access to field results in a deref of a null' 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 Reviewed-by: Gary Lockyer --- source3/lib/dbwrap/dbwrap_ctdb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 33558e442f3..0e108920f58 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -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;