Author: khornicek
Date: Sun Apr 6 17:09:47 2014
New Revision: 62667
URL:
http://svn.reactos.org/svn/reactos?rev=62667&view=rev
Log:
[MAIN]
- fix a memory leak
CID #716340
- initialize the new cursor scheme name so it doesn't show garbage in the save dialog
The previous commit fixed:
CID #716120
CID #715936
CID #515183
Modified:
trunk/reactos/dll/cpl/main/mouse.c
Modified: trunk/reactos/dll/cpl/main/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/mouse.c?rev=6…
==============================================================================
--- trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] Sun Apr 6 17:09:47 2014
@@ -718,6 +718,7 @@
if (nSel == 0)
{
szSchemeName[0] = 0;
+ szNewSchemeName[0] = 0;
}
else
{
@@ -775,6 +776,9 @@
lpSchemeData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength *
sizeof(TCHAR));
+ if(!lpSchemeData)
+ return FALSE;
+
for (index = IDS_ARROW, i = 0; index <= IDS_HAND; index++, i++)
{
CompressPath(szTempPath, g_CursorData[i].szCursorPath);
@@ -784,11 +788,15 @@
}
if (RegOpenCurrentUser(KEY_READ | KEY_SET_VALUE, &hCuKey) != ERROR_SUCCESS)
+ {
+ HeapFree(GetProcessHeap(), 0, lpSchemeData);
return FALSE;
+ }
if (RegOpenKeyEx(hCuKey, _T("Control Panel\\Cursors\\Schemes"), 0, KEY_READ
| KEY_SET_VALUE, &hCuCursorKey) != ERROR_SUCCESS)
{
RegCloseKey(hCuKey);
+ HeapFree(GetProcessHeap(), 0, lpSchemeData);
return FALSE;
}