Author: pschweitzer
Date: Sat May 16 12:13:12 2015
New Revision: 67772
URL:
http://svn.reactos.org/svn/reactos?rev=67772&view=rev
Log:
[CRT]
Properly copy va_list (ie, do it in a portable and corrrect way) and make sure it
doesn't leak
Modified:
trunk/reactos/lib/sdk/crt/process/process.c
Modified: trunk/reactos/lib/sdk/crt/process/process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/process/proces…
==============================================================================
--- trunk/reactos/lib/sdk/crt/process/process.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/process/process.c [iso-8859-1] Sat May 16 12:13:12 2015
@@ -152,13 +152,14 @@
static _TCHAR*
valisttosT(const _TCHAR* arg0, va_list alist, _TCHAR delim)
{
- va_list alist2 = alist;
+ va_list alist2;
_TCHAR *ptr, *str;
size_t len;
if (arg0 == NULL)
return NULL;
+ va_copy(alist2, alist);
ptr = (_TCHAR*)arg0;
len = 0;
do
@@ -170,7 +171,10 @@
str = (_TCHAR*) malloc((len + 1) * sizeof(_TCHAR));
if (str == NULL)
+ {
+ va_end(alist2);
return NULL;
+ }
ptr = str;
do
@@ -184,6 +188,7 @@
while(arg0 != NULL);
*ptr = 0;
+ va_end(alist2);
return str;
}