[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - libreofficekit/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 9 09:15:58 UTC 2021


 libreofficekit/source/gtk/lokdocview.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 087c9fe1ba0ad5c83745605d78715d5489762345
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 20 20:14:43 2021 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Fri Jul 9 11:15:26 2021 +0200

    cid#1478187 Resource leak
    
    Change-Id: Ib63d25e358f81c428fcbbb502650c37d016b6b44
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112821
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit da86cd492c5a04c42086985e17ae84d63bdedd0b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118617
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index c1fcc5542750..156224b57351 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -991,19 +991,28 @@ payloadToRectangle (LOKDocView* pDocView, const char* pPayload)
     aRet.width = aRet.height = aRet.x = aRet.y = 0;
 
     if (!*ppCoordinate)
+    {
+        g_strfreev(ppCoordinates);
         return aRet;
+    }
     aRet.x = atoi(*ppCoordinate);
     if (aRet.x < 0)
         aRet.x = 0;
     ++ppCoordinate;
     if (!*ppCoordinate)
+    {
+        g_strfreev(ppCoordinates);
         return aRet;
+    }
     aRet.y = atoi(*ppCoordinate);
     if (aRet.y < 0)
         aRet.y = 0;
     ++ppCoordinate;
     if (!*ppCoordinate)
+    {
+        g_strfreev(ppCoordinates);
         return aRet;
+    }
     long l = atol(*ppCoordinate);
     if (l > std::numeric_limits<int>::max())
         aRet.width = std::numeric_limits<int>::max();
@@ -1013,7 +1022,10 @@ payloadToRectangle (LOKDocView* pDocView, const char* pPayload)
         aRet.width = priv->m_nDocumentWidthTwips - aRet.x;
     ++ppCoordinate;
     if (!*ppCoordinate)
+    {
+        g_strfreev(ppCoordinates);
         return aRet;
+    }
     l = atol(*ppCoordinate);
     if (l > std::numeric_limits<int>::max())
         aRet.height = std::numeric_limits<int>::max();
@@ -1021,8 +1033,8 @@ payloadToRectangle (LOKDocView* pDocView, const char* pPayload)
         aRet.height = l;
     if (aRet.y + aRet.height > priv->m_nDocumentHeightTwips)
         aRet.height = priv->m_nDocumentHeightTwips - aRet.y;
-    g_strfreev(ppCoordinates);
 
+    g_strfreev(ppCoordinates);
     return aRet;
 }
 


More information about the Libreoffice-commits mailing list