[syslinux:elflink] bufprintf: Add va_end() for our va_copy()
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Tue Nov 27 14:15:02 PST 2012
Commit-ID: 6f50d20ba362315dea4ecaf44336c3aaa4284975
Gitweb: http://www.syslinux.org/commit/6f50d20ba362315dea4ecaf44336c3aaa4284975
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Thu, 15 Nov 2012 20:39:30 +0000
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Thu, 15 Nov 2012 20:39:30 +0000
bufprintf: Add va_end() for our va_copy()
According to the stdarg(3) man page each invocation of va_copy()
should be paired with an invocation of va_end().
Cc: Erwan Velu <erwanaliasr1 at gmail.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
com32/lib/bufprintf.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/com32/lib/bufprintf.c b/com32/lib/bufprintf.c
index 939bcec..d281231 100644
--- a/com32/lib/bufprintf.c
+++ b/com32/lib/bufprintf.c
@@ -17,8 +17,10 @@ int vbufprintf(struct print_buf *buf, const char *format, va_list ap)
char *newbuf;
newbuf = realloc(buf->buf, newsize);
- if (!newbuf)
- return -1;
+ if (!newbuf) {
+ rv = -1;
+ goto bail;
+ }
buf->buf = newbuf;
buf->size = newsize;
@@ -26,6 +28,8 @@ int vbufprintf(struct print_buf *buf, const char *format, va_list ap)
rv = vsnprintf(buf->buf + buf->len, buf->size - buf->len, format, ap2);
buf->len += rv;
+bail:
+ va_end(ap2);
return rv;
}
More information about the Syslinux-commits
mailing list