va_copy must be matched by va_end

Hat tip to @rfuchs. See: https://github.com/redis/hiredis/pull/178.

Fixes #1187
This commit is contained in:
Pieter Noordhuis 2013-07-10 21:12:46 -07:00 committed by antirez
parent 3426866e0a
commit cf85b5ba81

View File

@ -388,6 +388,7 @@ sds sdscatvprintf(sds s, const char *fmt, va_list ap) {
buf[buflen-2] = '\0';
va_copy(cpy,ap);
vsnprintf(buf, buflen, fmt, cpy);
va_end(ap);
if (buf[buflen-2] != '\0') {
if (buf != staticbuf) zfree(buf);
buflen *= 2;