vcl/unx/generic/gdi/cairotextrender.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit c27280c512683a52a19af6448f84f0533655d8fa
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Dec 1 09:45:47 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Dec 1 13:57:21 2022 +0100

    ofz#53904 Indirect-leak
    
    Change-Id: Idc688c5afc14d2ba83b6af30ee6bb30c90f53ae4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143518
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index 0a5ae547360c..3dbaa79cd1e5 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -19,8 +19,8 @@
 
 #include <sal/config.h>
 
+#include <comphelper/scopeguard.hxx>
 #include <unx/cairotextrender.hxx>
-
 #include <unx/fc_fontoptions.hxx>
 #include <unx/freetype_glyphcache.hxx>
 #include <headless/CairoCommon.hxx>
@@ -180,6 +180,7 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
         SAL_WARN("vcl", "no cairo context for text");
         return;
     }
+    comphelper::ScopeGuard releaseContext([this, cr]() { 
releaseCairoContext(cr); });
 
     std::vector<cairo_glyph_t> cairo_glyphs;
     std::vector<int> glyph_extrarotation;
@@ -393,8 +394,6 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
         aI = aNext;
     }
 
-    releaseCairoContext(cr);
-
 #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
     if (__lsan_enable)
         __lsan_enable();

Reply via email to