[COMCTL32] Don't leak memory in CB_ThemedPaint()
authorPierre Schweitzer <pierre@reactos.org>
Fri, 16 Nov 2018 20:52:38 +0000 (21:52 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 16 Nov 2018 21:07:09 +0000 (22:07 +0100)
CID 1441313

dll/win32/comctl32/button.c

index 6a0a226..5906747 100644 (file)
@@ -1995,12 +1995,16 @@ static void CB_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, Bu
         }
 
         heap_free(text);
         }
 
         heap_free(text);
+#ifdef __REACTOS__
+        text = NULL;
+#endif
     }
 
 #ifdef __REACTOS__
     if (cdrf == CDRF_NOTIFYPOSTPAINT)
         BUTTON_SendCustomDraw(infoPtr, hDC, CDDS_POSTPAINT, &bgRect);
 cleanup:
     }
 
 #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);
 #endif
     if (created_font) DeleteObject(font);
     if (hPrevFont) SelectObject(hDC, hPrevFont);