Skip to content

Resolve "CID 465168: Null pointer dereference in lib/ns/client.c"

In the ns__client_put_cb() callback function the 'client->manager' pointer is guaranteed to be non-NULL, because in ns__client_request(), before setting up the callback, the ns__client_setup() function is called for the 'client', which makes sure that 'client->manager' is set.

Removing the NULL-check resolves the following static analyzer warning:

/lib/ns/client.c: 1675 in ns__client_put_cb()
1669     		dns_message_puttemprdataset(client->message, &client->opt);
1670     	}
1671     	client_extendederror_reset(client);
1672
1673     	dns_message_detach(&client->message);
1674
>>>     CID 465168:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "client->manager" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1675     	if (client->manager != NULL) {
1676     		ns_clientmgr_detach(&client->manager);
1677     	}
1678
1679     	/*
1680     	 * Detaching the task must be done after unlinking from

Closes #4299 (closed)

Merge request reports