[USERSRV] HardError: Free WindowTitleU buffer only if we really allocated it.

This commit is contained in:
Hermès Bélusca-Maïto 2018-06-09 15:37:54 +02:00
parent 704baed2df
commit 7cb411e88f
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -641,8 +641,10 @@ UserpFormatMessages(
CaptionStringU->Length = (USHORT)(wcslen(CaptionStringU->Buffer) * sizeof(WCHAR));
/* Free the strings if needed */
if (WindowTitleU.Buffer) RtlFreeUnicodeString(&WindowTitleU);
if (hProcess) RtlFreeUnicodeString(&FileNameU);
if (WindowTitleU.Buffer && (WindowTitleU.MaximumLength != 0))
RtlFreeUnicodeString(&WindowTitleU);
if (hProcess)
RtlFreeUnicodeString(&FileNameU);
Format2A.Buffer = NULL;