From cc27dfd4bc06df7c8ed5ca425e2ef0c12485a6d9 Mon Sep 17 00:00:00 2001 From: Joachim Henze Date: Mon, 10 Oct 2022 02:34:14 +0200 Subject: [PATCH] [0.4.9][NTGDI] 'otm' is always non-NULL in epilogue CORE-16993 is a small optimization picked from 0.4.14-dev-108-g 1bf982ff88b1c0400c1a66ed9aaa8faeba74a75c otm is checked for NULL already a few lines before in that function, and is not touched anymore in between the two locations. Tiny bit shorter+smaller now, and might satisfy also some static code-analysis. The origin of checking it twice for NULL dates back into the pre-0.4.7-era of ros. --- win32ss/gdi/ntgdi/font.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/win32ss/gdi/ntgdi/font.c b/win32ss/gdi/ntgdi/font.c index 7d1aebbb66a..d57c01d7bda 100644 --- a/win32ss/gdi/ntgdi/font.c +++ b/win32ss/gdi/ntgdi/font.c @@ -908,25 +908,24 @@ NtGdiGetOutlineTextMetricsInternalW (HDC hDC, return 0; } IntGetOutlineTextMetrics(FontGDI, Size, potm); - if (otm) - { - _SEH2_TRY - { - ProbeForWrite(otm, Size, 1); - RtlCopyMemory(otm, potm, Size); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - if (!NT_SUCCESS(Status)) - { - EngSetLastError(ERROR_INVALID_PARAMETER); - Size = 0; - } + _SEH2_TRY + { + ProbeForWrite(otm, Size, 1); + RtlCopyMemory(otm, potm, Size); } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END + + if (!NT_SUCCESS(Status)) + { + EngSetLastError(ERROR_INVALID_PARAMETER); + Size = 0; + } + ExFreePoolWithTag(potm,GDITAG_TEXT); return Size; }