Add va_end for every va_start.

Dotan Barak, dotanba at gmail dot com



git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@23 327403b1-1117-474d-bef2-5cb71233fd97
This commit is contained in:
Michael Clark
2009-01-05 03:57:59 +00:00
parent a0d35c7ebf
commit 8cdac64ccd
4 changed files with 9 additions and 1 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;