From 16e54c4e6e767e5c923e7d5849a285b38d3345d0 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Sat, 27 Oct 2012 20:38:22 +0200 Subject: [PATCH] Add missing va_end() calls Add missing va_end() calls on all error paths --- lib/socket.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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); } -- 2.40.0