Skip to content

Commit fc75870

Browse files
committed
[WIN32SS:NTGDI] Addendum to commit 108db5b (PR reactos#8536)
- In the `if (!psurf)` code path, unlock in the reverse locking order. - Move the `SafeInData == NULL` check outside of `_SEH2_TRY` and just after the `ExAllocatePoolWithTag` call. - Removing trailing whitespace.
1 parent 108db5b commit fc75870

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

win32ss/gdi/ntgdi/print.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ NtGdiExtEscape(
132132
else
133133
{
134134
PDC pDC = DC_LockDc(hDC);
135-
if ( pDC == NULL )
135+
if (pDC == NULL)
136136
{
137137
EngSetLastError(ERROR_INVALID_HANDLE);
138138
return -1;
@@ -149,8 +149,8 @@ NtGdiExtEscape(
149149
if (!psurf)
150150
{
151151
EngReleaseSemaphore(ppdev->hsemDevLock);
152-
DC_UnlockDc(pDC);
153152
PDEVOBJ_vRelease(ppdev);
153+
DC_UnlockDc(pDC);
154154
return 0;
155155
}
156156
SURFACE_ShareLockByPointer(psurf);
@@ -167,26 +167,23 @@ NtGdiExtEscape(
167167
}
168168

169169
if (InSize)
170-
{
170+
{
171171
SafeInData = ExAllocatePoolWithTag(PagedPool, InSize, GDITAG_TEMP);
172+
if (SafeInData == NULL)
173+
{
174+
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
175+
goto Exit;
176+
}
172177
_SEH2_TRY
173178
{
174-
if (SafeInData == NULL)
175-
{
176-
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
177-
goto Exit;
178-
}
179-
else
180-
{
181-
ProbeForRead(UnsafeInData, InSize, 1);
182-
RtlCopyMemory(SafeInData, UnsafeInData, InSize);
183-
}
179+
ProbeForRead(UnsafeInData, InSize, 1);
180+
RtlCopyMemory(SafeInData, UnsafeInData, InSize);
184181
}
185182
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
186183
{
187184
Status = _SEH2_GetExceptionCode();
188185
SetLastNtError(Status);
189-
goto Exit;
186+
_SEH2_YIELD(goto Exit);
190187
}
191188
_SEH2_END;
192189
}
@@ -203,7 +200,7 @@ NtGdiExtEscape(
203200
{
204201
Status = _SEH2_GetExceptionCode();
205202
SetLastNtError(Status);
206-
goto Exit;
203+
_SEH2_YIELD(goto Exit);
207204
}
208205
_SEH2_END;
209206
}
@@ -245,7 +242,6 @@ NtGdiExtEscape(
245242
EngReleaseSemaphore(ppdev->hsemDevLock);
246243
PDEVOBJ_vRelease(ppdev);
247244

248-
249245
if (SafeInData != NULL)
250246
{
251247
ExFreePoolWithTag(SafeInData, GDITAG_TEMP);

0 commit comments

Comments
 (0)