]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
I think this is actually more correct from what I read.
authorMichael Jerris <mike@jerris.com>
Sat, 24 Mar 2007 20:12:41 +0000 (20:12 +0000)
committerMichael Jerris <mike@jerris.com>
Sat, 24 Mar 2007 20:12:41 +0000 (20:12 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4764 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_apr.c

index 2f2c650ff8b06cde9914ea48031d95463769678f..0e1e5d606aeaea36d8d1f0bac5a11603e023bc03 100644 (file)
@@ -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