dwrite: Handle allocation error (Coverity)

Nikolay Sivov nsivov at codeweavers.com
Wed Nov 28 23:53:11 CST 2012


Handle allocation error (Coverity)
-------------- next part --------------
>From 4888ae10f45f5707411f7f51e4eb1aa2ac274269 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu, 29 Nov 2012 07:38:21 -0500
Subject: [PATCH 4/6] Handle allocation error (Coverity)

---
 dlls/dwrite/font.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 7d332b7..0ec581b 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -930,6 +930,13 @@ HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **font)
 
     ret = GetOutlineTextMetricsW(hdc, 0, NULL);
     otm = heap_alloc(ret);
+    if (!otm)
+    {
+        heap_free(This);
+        DeleteDC(hdc);
+        DeleteObject(hfont);
+        return E_OUTOFMEMORY;
+    }
     otm->otmSize = ret;
     ret = GetOutlineTextMetricsW(hdc, otm->otmSize, otm);
 
-- 
1.7.10.4




More information about the wine-patches mailing list