can't free non-allocated memory

svn path=/trunk/; revision=11873
This commit is contained in:
Gunnar Dalsnes 2004-11-30 02:28:00 +00:00
parent bcf7f5403f
commit 00641f6f5b

View file

@ -656,7 +656,6 @@ GetCPFileNameFromRegistry(UINT CodePage, LPWSTR FileName, ULONG FileNameSize)
Status = NtOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes); Status = NtOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
RtlFreeUnicodeString(&ValueName);
return FALSE; return FALSE;
} }
@ -667,14 +666,13 @@ GetCPFileNameFromRegistry(UINT CodePage, LPWSTR FileName, ULONG FileNameSize)
if (Kvpi == NULL) if (Kvpi == NULL)
{ {
NtClose(KeyHandle); NtClose(KeyHandle);
RtlFreeUnicodeString(&ValueName);
return FALSE; return FALSE;
} }
/* Query the file name for our code page. */ /* Query the file name for our code page. */
Status = NtQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation, Status = NtQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation,
Kvpi, KvpiSize, &KvpiSize); Kvpi, KvpiSize, &KvpiSize);
RtlFreeUnicodeString(&ValueName);
NtClose(KeyHandle); NtClose(KeyHandle);
/* Check if we succeded and the value is non-empty string. */ /* Check if we succeded and the value is non-empty string. */