diff --git a/reactos/win32ss/gdi/ntgdi/icm.c b/reactos/win32ss/gdi/ntgdi/icm.c index d06dfc2b5d1..9a2812b2451 100644 --- a/reactos/win32ss/gdi/ntgdi/icm.c +++ b/reactos/win32ss/gdi/ntgdi/icm.c @@ -150,8 +150,12 @@ NtGdiGetDeviceGammaRamp( } Ret = IntGetDeviceGammaRamp((HDEV)dc->ppdev, SafeRamp); - - if (!Ret) return Ret; + if (!Ret) + { + DC_UnlockDc(dc); + ExFreePoolWithTag(SafeRamp, GDITAG_ICM); + return Ret; + } _SEH2_TRY {