mirror of
https://gitee.com/openharmony/third_party_libnl
synced 2024-11-27 20:20:30 +00:00
Add missing va_end() calls
Add missing va_end() calls on all error paths
This commit is contained in:
parent
503270c1c8
commit
16e54c4e6e
16
lib/socket.c
16
lib/socket.c
@ -347,13 +347,17 @@ int nl_socket_add_memberships(struct nl_sock *sk, int group, ...)
|
||||
va_start(ap, group);
|
||||
|
||||
while (group != 0) {
|
||||
if (group < 0)
|
||||
if (group < 0) {
|
||||
va_end(ap);
|
||||
return -NLE_INVAL;
|
||||
}
|
||||
|
||||
err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
|
||||
&group, sizeof(group));
|
||||
if (err < 0)
|
||||
if (err < 0) {
|
||||
va_end(ap);
|
||||
return -nl_syserr2nlerr(errno);
|
||||
}
|
||||
|
||||
group = va_arg(ap, int);
|
||||
}
|
||||
@ -391,13 +395,17 @@ int nl_socket_drop_memberships(struct nl_sock *sk, int group, ...)
|
||||
va_start(ap, group);
|
||||
|
||||
while (group != 0) {
|
||||
if (group < 0)
|
||||
if (group < 0) {
|
||||
va_end(ap);
|
||||
return -NLE_INVAL;
|
||||
}
|
||||
|
||||
err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP,
|
||||
&group, sizeof(group));
|
||||
if (err < 0)
|
||||
if (err < 0) {
|
||||
va_end(ap);
|
||||
return -nl_syserr2nlerr(errno);
|
||||
}
|
||||
|
||||
group = va_arg(ap, int);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user