sd-netlink: add several assertions

This commit is contained in:
Yu Watanabe 2020-12-18 13:12:09 +09:00
parent 2d1ad72456
commit f6dab7489e
2 changed files with 3 additions and 1 deletions

View File

@ -244,7 +244,8 @@ int socket_writev_message(sd_netlink *nl, sd_netlink_message **m, size_t msgcoun
size_t i;
assert(nl);
assert(msgcount);
assert(m);
assert(msgcount > 0);
iovs = new0(struct iovec, msgcount);
if (!iovs)

View File

@ -237,6 +237,7 @@ int sd_netlink_sendv(sd_netlink *nl,
assert_return(nl, -EINVAL);
assert_return(!rtnl_pid_changed(nl), -ECHILD);
assert_return(messages, -EINVAL);
assert_return(msgcount > 0, -EINVAL);
if (ret_serial) {
serials = new0(uint32_t, msgcount);