https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3fddd3157ce506f9e9449…
commit 3fddd3157ce506f9e94498ff6c21cca23bf67d49
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Fri Nov 16 21:22:50 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Fri Nov 16 22:07:08 2018 +0100
[COMCTL32] Don't leak memory in PB_ThemedPaint()
CID 1441373
---
dll/win32/comctl32/button.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dll/win32/comctl32/button.c b/dll/win32/comctl32/button.c
index 813aa7455d..6a0a226ea1 100644
--- a/dll/win32/comctl32/button.c
+++ b/dll/win32/comctl32/button.c
@@ -1841,6 +1841,9 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr,
HDC hDC, Bu
{
DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0,
&textRect);
heap_free(text);
+#ifdef __REACTOS__
+ text = NULL;
+#endif
}
if (focused)
@@ -1862,6 +1865,7 @@ static void PB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr,
HDC hDC, Bu
if (cdrf == CDRF_NOTIFYPOSTPAINT)
BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
cleanup:
+ if (text) heap_free(text);
#endif
if (hPrevFont) SelectObject(hDC, hPrevFont);
}