summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-24 12:04:48 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-24 12:04:48 +0200
commitf7af63fd86f69a2959507c5b8dc2e5bf60e704d0 (patch)
tree126b4ac61d8603f7d690b3e62f734f1916c19295
parent9b08c804ef5197ab29f0ef1d96e589ed9c018019 (diff)
downloadsystemd-assert-cleanups-and-constification.tar.gz
sd-dhcp-client: do not call assert in public functionsassert-cleanups-and-constification
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 9652f70cc0..1c5de5392c 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -548,7 +548,8 @@ static sd_dhcp_option* dhcp_option_free(sd_dhcp_option *i) {
}
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)
@@ -2047,7 +2048,8 @@ sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client) {
}
static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) {
- assert(client);
+ if (!client)
+ return NULL;
log_dhcp_client(client, "FREE");
@@ -2073,11 +2075,9 @@ static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) {
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;