Fixes:
source4/dsdb/common/util.c:2000:6: warning: Access to field 'count' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
if (res->count != 1) {
^~~
source4/dsdb/common/util.c:3281:28: warning: Access to field 'msgs' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
el = ldb_msg_find_element(res->msgs[0], attr);
^~~
source4/dsdb/common/util.c:3568:6: warning: Access to field 'count' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
if (res->count != 1 || ret != LDB_SUCCESS) {
^~~
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
talloc_free(local_ctx);
return ret;
}
+ /* should never be true with 'ret=LDB_SUCCESS', here to satisfy clang */
+ if (res == NULL) {
+ talloc_free(local_ctx);
+ return LDB_ERR_OTHER;
+ }
if (res->count != 1) {
*errstring = talloc_asprintf(mem_ctx, "Invalid dn (%s), not child of a domain object",
ldb_dn_get_linearized(dn));
return WERR_DS_DRA_INTERNAL_ERROR;
}
+ /* satisfy clang */
+ if (res == NULL) {
+ talloc_free(tmp_ctx);
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
el = ldb_msg_find_element(res->msgs[0], attr);
if (el == NULL) {
/* it's OK to be empty */
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],