From: Douglas Bagnall Date: Tue, 30 Jul 2019 22:16:37 +0000 (+1200) Subject: CID 1452109: dsdb/util: do not check for NULL after deref X-Git-Tag: tdb-1.4.2~390 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5ec857abe99748dd478cdc988fa3399401334dc;p=thirdparty%2Fsamba.git CID 1452109: dsdb/util: do not check for NULL after deref This is all strictly unnecessary, as ret is always != LDB_SUCCESS when res is NULL, but we want to make peace between clang and converity. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 51d6b243347..1c71c243ed5 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -3582,18 +3582,12 @@ int samdb_dns_host_name(struct ldb_context *sam_ctx, const char **host_name) ret = dsdb_search_dn(sam_ctx, tmp_ctx, &res, NULL, attrs, 0); - if (res->count != 1 || ret != LDB_SUCCESS) { + if (res == NULL || res->count != 1 || ret != LDB_SUCCESS) { DEBUG(0, ("Failed to get rootDSE for dnsHostName: %s", ldb_errstring(sam_ctx))); TALLOC_FREE(tmp_ctx); return ret; } - /* satisfy clang */ - if (res == NULL) { - TALLOC_FREE(tmp_ctx); - return LDB_ERR_OTHER; - } - _host_name = ldb_msg_find_attr_as_string(res->msgs[0], "dnsHostName",