chiark / gitweb /
shared: call va_end in all cases
authorLukas Nykryn <lnykryn@redhat.com>
Fri, 21 Sep 2012 08:22:46 +0000 (10:22 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 21 Sep 2012 10:07:41 +0000 (12:07 +0200)
src/shared/log.c
src/shared/util.c

index 7b0a914..b618458 100644 (file)
@@ -719,7 +719,6 @@ int log_struct_internal(
 
                         format = va_arg(ap, char *);
                 }
-                va_end(ap);
 
                 zero(mh);
                 mh.msg_iov = iovec;
@@ -731,6 +730,7 @@ int log_struct_internal(
                         r = 1;
 
         finish:
+                va_end(ap);
                 for (i = 1; i < n; i += 2)
                         free(iovec[i].iov_base);
 
index be94515..97f766c 100644 (file)
@@ -5024,8 +5024,10 @@ char *strjoin(const char *x, ...) {
                                 break;
 
                         n = strlen(t);
-                        if (n > ((size_t) -1) - l)
+                        if (n > ((size_t) -1) - l) {
+                                va_end(ap);
                                 return NULL;
+                        }
 
                         l += n;
                 }