From cf5d9848d800706cd2ba8dc5544f0414f0ac8f37 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 12 Jul 2015 23:35:10 +0300 Subject: [PATCH] dwrite: Check GetGdiCompatibleMetrics() return value (Coverity). --- dlls/dwrite/analyzer.c | 7 ++++++- dlls/dwrite/layout.c | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 8c2a8012403..341710983ca 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -1090,7 +1090,12 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite return hr; } - IDWriteFontFace_GetGdiCompatibleMetrics(fontface, emSize, pixels_per_dip, transform, &metrics); + hr = IDWriteFontFace_GetGdiCompatibleMetrics(fontface, emSize, pixels_per_dip, transform, &metrics); + if (FAILED(hr)) { + IDWriteFontFace1_Release(fontface1); + WARN("failed to get compat metrics, 0x%08x\n", hr); + return hr; + } for (i = 0; i < glyph_count; i++) { INT32 a; diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 8b4c2cd33d0..70e20955a82 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -828,12 +828,13 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) /* baseline derived from font metrics */ if (layout->gdicompatible) { - /* FIXME: check return value when it's actually implemented */ - IDWriteFontFace_GetGdiCompatibleMetrics(run->run.fontFace, + hr = IDWriteFontFace_GetGdiCompatibleMetrics(run->run.fontFace, run->run.fontEmSize, layout->pixels_per_dip, &layout->transform, &fontmetrics); + if (FAILED(hr)) + WARN("failed to get compat metrics, 0x%08x\n", hr); } else IDWriteFontFace_GetMetrics(run->run.fontFace, &fontmetrics);