[PATCH 2/4] gdiplus: Add missing allocation failure checks to graphics functions.

Shawn M. Chapla schapla at codeweavers.com
Tue Aug 25 17:13:39 CDT 2020


Signed-off-by: Shawn M. Chapla <schapla at codeweavers.com>
---
 dlls/gdiplus/graphics.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 57022003249..c3542b3d65d 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -5192,7 +5192,14 @@ GpStatus gdip_format_string(HDC hdc,
     }
 
     if (hotkeyprefix_count)
+    {
         hotkeyprefix_offsets = heap_alloc_zero(sizeof(INT) * hotkeyprefix_count);
+        if (!hotkeyprefix_offsets)
+        {
+            heap_free(stringdup);
+            return OutOfMemory;
+        }
+    }
 
     hotkeyprefix_count = 0;
 
@@ -6555,6 +6562,7 @@ GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics *graphics,GpPen *pen,GDIPCONST G
 
     if(count<=0)    return InvalidParameter;
     ptf = heap_alloc_zero(sizeof(GpPointF) * count);
+    if (!ptf) return OutOfMemory;
 
     for(i = 0;i < count; i++){
         ptf[i].X = (REAL)points[i].X;
-- 
2.28.0




More information about the wine-devel mailing list