- 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

svn path=/trunk/; revision=62667
This commit is contained in:
Kamil Hornicek 2014-04-06 17:09:47 +00:00
parent 3cf4d36849
commit 0bd2bad093

View file

@ -718,6 +718,7 @@ SaveCursorScheme(HWND hwndDlg)
if (nSel == 0)
{
szSchemeName[0] = 0;
szNewSchemeName[0] = 0;
}
else
{
@ -775,6 +776,9 @@ SaveCursorScheme(HWND hwndDlg)
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 @@ SaveCursorScheme(HWND hwndDlg)
}
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;
}