diff --git a/ChangeLog b/ChangeLog index 0c964d6..784663a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 0.8 + * Add va_end for every va_start + Dotan Barak, dotanba at gmail dot com * Add macros to enable compiling out debug code Geoffrey Young, geoff at modperlcookbook dot org * Fix bug with use of capital E in numbers with exponents diff --git a/debug.c b/debug.c index eaa6fca..f699976 100644 --- a/debug.c +++ b/debug.c @@ -51,6 +51,7 @@ void mc_abort(const char *msg, ...) } else #endif vprintf(msg, ap); + va_end(ap); exit(1); } @@ -66,6 +67,7 @@ void mc_debug(const char *msg, ...) } else #endif vprintf(msg, ap); + va_end(ap); } } @@ -79,6 +81,7 @@ void mc_error(const char *msg, ...) } else #endif vfprintf(stderr, msg, ap); + va_end(ap); } void mc_info(const char *msg, ...) @@ -91,4 +94,5 @@ void mc_info(const char *msg, ...) } else #endif vfprintf(stderr, msg, ap); + va_end(ap); } diff --git a/linkhash.c b/linkhash.c index 6cfc9a0..fc72bf6 100644 --- a/linkhash.c +++ b/linkhash.c @@ -25,6 +25,7 @@ void lh_abort(const char *msg, ...) va_list ap; va_start(ap, msg); vprintf(msg, ap); + va_end(ap); exit(1); } diff --git a/printbuf.c b/printbuf.c index 0ee45e0..cdda47e 100644 --- a/printbuf.c +++ b/printbuf.c @@ -119,8 +119,9 @@ int sprintbuf(struct printbuf *p, const char *msg, ...) if(size == -1 || size > 127) { int ret; va_start(ap, msg); - if((size = vasprintf(&t, msg, ap)) == -1) return -1; + size = vasprintf(&t, msg, ap); va_end(ap); + if(size == -1) return -1; ret = printbuf_memappend(p, t, size); free(t); return ret;