From: Noel Power Date: Wed, 12 Jun 2019 14:55:43 +0000 (+0000) Subject: lib/tdb: clang: Fix warning: Dereference of null pointer X-Git-Tag: ldb-2.0.5~193 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7987e4af96b1c2b285834a9d3a9c00b028039737;p=thirdparty%2Fsamba.git lib/tdb: clang: Fix warning: Dereference of null pointer Fixes: lib/tdb/common/lock.c:933:6: warning: Dereference of null pointer <--[clang] if (tdb->allrecord_lock.count) { ^~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Noel Power Reviewed-by: Gary Lockyer --- diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c index f55184d8be5..5fba02f9b12 100644 --- a/lib/tdb/common/lock.c +++ b/lib/tdb/common/lock.c @@ -927,6 +927,9 @@ int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off) int tdb_write_lock_record(struct tdb_context *tdb, tdb_off_t off) { struct tdb_traverse_lock *i; + if (tdb == NULL) { + return -1; + } for (i = &tdb->travlocks; i; i = i->next) if (i->off == off) return -1;