[WIN32K] Fix 'use after free' in NtGdiStretchDIBitsInternal (#4122)

CORE-17861
This commit is contained in:
Doug Lyons 2021-11-21 19:57:36 -06:00 committed by GitHub
parent f766ca5e42
commit b538b9abb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1489,7 +1489,6 @@ NtGdiStretchDIBitsInternal(
if (pdc) DC_UnlockDc(pdc); if (pdc) DC_UnlockDc(pdc);
} }
if (pbmiSafe) ExFreePoolWithTag(pbmiSafe, 'imBG');
if (pvBits) ExFreePoolWithTag(pvBits, TAG_DIB); if (pvBits) ExFreePoolWithTag(pvBits, TAG_DIB);
/* This is not what MSDN says is returned from this function, but it /* This is not what MSDN says is returned from this function, but it
@ -1504,6 +1503,8 @@ NtGdiStretchDIBitsInternal(
LinesCopied = pbmiSafe->bmiHeader.biHeight; LinesCopied = pbmiSafe->bmiHeader.biHeight;
} }
ExFreePoolWithTag(pbmiSafe, 'imBG');
return LinesCopied; return LinesCopied;
} }