(try 2)version: check for out of memory when VerInstallFileA/W converstion. (response to coverity 635)

Rob Shearman robertshearman at gmail.com
Thu Oct 2 10:03:04 CDT 2008


2008/10/2 Aric Stewart <aric at codeweavers.com>:
> @@ -543,34 +543,50 @@ DWORD WINAPI VerInstallFileW(
>          len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL );
>          if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len )))
>              WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL );
> +        else
> +            ret = VIF_OUTOFMEMORY;
>      }
> -    if (srcdir)
> +    if (srcdir &&  !ret)

Remove the extra space here.

> +    static const CHAR szSrcDir[] = "C:\\windows\\temp";
> +    static const CHAR szDestDir[] = "C:\\windows\\temp\\test";
> +    static const CHAR szCurDir[] = "C:\\";

This isn't exactly what I meant. C:\Windows might not even exist on
NT4/Win2000 and the temp directory might not be in %WINDIR%\temp. You
should use GetTempPath instead. (Hard-coding C:\ is also something to
be avoided if at all possible.)

-- 
Rob Shearman



More information about the wine-devel mailing list