]> granicus.if.org Git - libnl/commitdiff
Add missing va_end() calls
authorMichele Baldessari <michele@acksyn.org>
Sat, 27 Oct 2012 18:38:22 +0000 (20:38 +0200)
committerThomas Graf <tgraf@redhat.com>
Mon, 29 Oct 2012 17:16:58 +0000 (18:16 +0100)
Add missing va_end() calls on all error paths

lib/socket.c

index 4e1d84ce09a6aaf9fcd3ac5d11e09d11b2bbb1df..724fb7aca5daa8874fe411d801ebf274cf64bca8 100644 (file)
@@ -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);
        }