I think this is actually more correct from what I read.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4764 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
496bae429a
commit
a7909fb093
|
@ -616,8 +616,15 @@ SWITCH_DECLARE(int) switch_vasprintf(char **ret, const char *fmt, va_list ap)
|
|||
char *buf;
|
||||
int len;
|
||||
size_t buflen;
|
||||
va_list ap2;
|
||||
|
||||
len = vsnprintf(NULL, 0, fmt, ap);
|
||||
#ifdef _MSC_VER
|
||||
ap2 = ap;
|
||||
#else
|
||||
va_copy(ap2, ap);
|
||||
#endif
|
||||
|
||||
len = vsnprintf(NULL, 0, fmt, ap2);
|
||||
|
||||
if (len > 0 && (buf = malloc((buflen = (size_t)(len + 1)))) != NULL) {
|
||||
len = vsnprintf(buf, buflen, fmt, ap);
|
||||
|
@ -627,6 +634,7 @@ SWITCH_DECLARE(int) switch_vasprintf(char **ret, const char *fmt, va_list ap)
|
|||
len = -1;
|
||||
}
|
||||
|
||||
va_end(ap2);
|
||||
return len;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue