diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-15 20:56:09 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-15 20:56:09 +0000 |
commit | 3da9e71f9ffa0ca968ccfcf26d536908d198ef5c (patch) | |
tree | 843fcf042d0c3c0c44564e47cb3f6936982f38c3 | |
parent | 6f50d20ba362315dea4ecaf44336c3aaa4284975 (diff) | |
download | syslinux-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.c | 5 |
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; |