aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-11-15 20:56:09 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-11-15 20:56:09 +0000
commit3da9e71f9ffa0ca968ccfcf26d536908d198ef5c (patch)
tree843fcf042d0c3c0c44564e47cb3f6936982f38c3
parent6f50d20ba362315dea4ecaf44336c3aaa4284975 (diff)
downloadsyslinux-3da9e71f9ffa0ca968ccfcf26d536908d198ef5c.tar.gz
syslinux-3da9e71f9ffa0ca968ccfcf26d536908d198ef5c.tar.xz
syslinux-3da9e71f9ffa0ca968ccfcf26d536908d198ef5c.zip
asprintf: Ensure we always call va_end(ap)
There's currently the potential for us to exit early from asprintf() without calling va_end(ap). Rearrange things so that we always make the call. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/lib/asprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/com32/lib/asprintf.c b/com32/lib/asprintf.c
index ef5b4b2f..eab20118 100644
--- a/com32/lib/asprintf.c
+++ b/com32/lib/asprintf.c
@@ -21,9 +21,10 @@ int asprintf(char **bufp, const char *format, ...)
*bufp = p = malloc(bytes);
if (!p)
- return -1;
+ rv = -1;
+ else
+ rv = vsnprintf(p, bytes, format, ap);
- rv = vsnprintf(p, bytes, format, ap);
va_end(ap);
return rv;