From: Noel Power Date: Fri, 24 May 2019 13:32:09 +0000 (+0000) Subject: lib/util: clang: Fix 'Null pointer passed as an argument...' warning X-Git-Tag: ldb-2.0.5~412 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8293d8459711e7f67cbd10f508868e463cbccac;p=thirdparty%2Fsamba.git lib/util: clang: Fix 'Null pointer passed as an argument...' warning Fixes: lib/util/debug.c:705:7: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang] Signed-off-by: Noel Power Reviewed-by: Gary Lockyer gary@catalyst.net.nz --- diff --git a/lib/util/debug.c b/lib/util/debug.c index d2fbab12414..c42022ec9bb 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -699,11 +699,15 @@ static int debug_lookup_classname_int(const char* classname) { size_t i; - if (!classname) return -1; + if (classname == NULL) { + return -1; + } for (i=0; i < debug_num_classes; i++) { - if (strcmp(classname, classname_table[i])==0) + char *entry = classname_table[i]; + if (entry != NULL && strcmp(classname, entry)==0) { return i; + } } return -1; } @@ -780,7 +784,7 @@ static int debug_lookup_classname(const char *classname) { int ndx; - if (!classname || !*classname) + if (classname == NULL || !*classname) return -1; ndx = debug_lookup_classname_int(classname);