From: Michele Baldessari Date: Sat, 27 Oct 2012 18:38:22 +0000 (+0200) Subject: Add missing va_end() calls X-Git-Tag: libnl3_2_15~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16e54c4e6e767e5c923e7d5849a285b38d3345d0;p=libnl Add missing va_end() calls Add missing va_end() calls on all error paths --- diff --git a/lib/socket.c b/lib/socket.c index 4e1d84c..724fb7a 100644 --- a/lib/socket.c +++ b/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); }