diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 7d332b74f67..0ec581bed5c 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);