Nikolay Sivov : shlwapi/tests: Fix uninitialized memory reads (Valgrind).
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Apr 13 07:42:01 CDT 2015
Module: wine
Branch: master
Commit: d6180c05b5a6fd3f0f5eae897c00d30527dc4ff0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d6180c05b5a6fd3f0f5eae897c00d30527dc4ff0
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sat Apr 11 12:05:25 2015 +0300
shlwapi/tests: Fix uninitialized memory reads (Valgrind).
---
dlls/shlwapi/tests/path.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c
index 7ffa000..84b3f4d 100644
--- a/dlls/shlwapi/tests/path.c
+++ b/dlls/shlwapi/tests/path.c
@@ -183,13 +183,18 @@ static const struct {
/* ################ */
-static LPWSTR GetWideString(const char* szString)
+static LPWSTR GetWideString(const char *src)
{
- LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
-
- MultiByteToWideChar(CP_ACP, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
+ WCHAR *ret;
- return wszString;
+ if (!src)
+ return NULL;
+
+ ret = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
+
+ MultiByteToWideChar(CP_ACP, 0, src, -1, ret, INTERNET_MAX_URL_LENGTH);
+
+ return ret;
}
static void FreeWideString(LPWSTR wszString)
More information about the wine-cvs
mailing list