}
int sd_dhcp_option_new(uint8_t option, void *data, size_t length, sd_dhcp_option **ret) {
- assert(ret);
+ assert_return(ret, -EINVAL);
+ assert_return(length == 0 || data, -EINVAL);
_cleanup_free_ void *q = memdup(data, length);
if (!q)
}
static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) {
- assert(client);
+ if (!client)
+ return NULL;
log_dhcp_client(client, "FREE");
DEFINE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp_client, sd_dhcp_client, dhcp_client_free);
int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize) {
- _cleanup_(sd_dhcp_client_unrefp) sd_dhcp_client *client = NULL;
-
assert_return(ret, -EINVAL);
- client = new(sd_dhcp_client, 1);
+ _cleanup_(sd_dhcp_client_unrefp) sd_dhcp_client *client = new(sd_dhcp_client, 1);
if (!client)
return -ENOMEM;