On Wed, Apr 27, 2016 at 02:43:27PM +0200, Hiltjo Posthuma wrote: > Hi, > > The following patch for httpd fixes unbalanced va_start() and va_end() macros. > This is in style with the rest of httpd. Also POSIX says: > > "Each invocation of the va_start() and va_copy() macros shall be matched by a > corresponding invocation of the va_end() macro in the same function." > > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdarg.h.html >
Yes agreed, the diff should be committed. ok jung@ if a dev wants to take care > Index: httpd.c > =================================================================== > RCS file: /cvs/src/usr.sbin/httpd/httpd.c,v > retrieving revision 1.54 > diff -u -p -r1.54 httpd.c > --- httpd.c 2 Feb 2016 17:51:11 -0000 1.54 > +++ httpd.c 27 Apr 2016 12:00:43 -0000 > @@ -1000,11 +1000,13 @@ kv_set(struct kv *kv, char *fmt, ...) > va_list ap; > char *value = NULL; > struct kv *ckv; > + int ret; > > va_start(ap, fmt); > - if (vasprintf(&value, fmt, ap) == -1) > - return (-1); > + ret = vasprintf(&value, fmt, ap); > va_end(ap); > + if (ret == -1) > + return (-1); > > /* Remove all children */ > while ((ckv = TAILQ_FIRST(&kv->kv_children)) != NULL) { > @@ -1025,11 +1027,13 @@ kv_setkey(struct kv *kv, char *fmt, ...) > { > va_list ap; > char *key = NULL; > + int ret; > > va_start(ap, fmt); > - if (vasprintf(&key, fmt, ap) == -1) > - return (-1); > + ret = vasprintf(&key, fmt, ap); > va_end(ap); > + if (ret == -1) > + return (-1); > > free(kv->kv_key); > kv->kv_key = key; > > --- > Kind regards, > Hiltjo >