https://git.reactos.org/?p=reactos.git;a=commitdiff;h=52da8448259ebe77a7e0fa8c971871072f7c6145

commit 52da8448259ebe77a7e0fa8c971871072f7c6145
Author:     Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Fri Nov 16 21:52:38 2018 +0100
Commit:     Pierre Schweitzer <pie...@reactos.org>
CommitDate: Fri Nov 16 22:07:09 2018 +0100

    [COMCTL32] Don't leak memory in CB_ThemedPaint()
    
    CID 1441313
---
 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 6a0a226ea1..59067471f1 100644
--- a/dll/win32/comctl32/button.c
+++ b/dll/win32/comctl32/button.c
@@ -1995,12 +1995,16 @@ static void CB_ThemedPaint(HTHEME theme, const 
BUTTON_INFO *infoPtr, HDC hDC, Bu
         }
 
         heap_free(text);
+#ifdef __REACTOS__
+        text = NULL;
+#endif
     }
 
 #ifdef __REACTOS__
     if (cdrf == CDRF_NOTIFYPOSTPAINT)
         BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
 cleanup:
+    if (text) heap_free(text);
 #endif
     if (created_font) DeleteObject(font);
     if (hPrevFont) SelectObject(hDC, hPrevFont);

Reply via email to