summaryrefslogtreecommitdiff
path: root/libreofficekit/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-20 20:14:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-21 15:32:55 +0100
commitda86cd492c5a04c42086985e17ae84d63bdedd0b (patch)
tree25f6188813f5b5a200a58d49c5b1ffe4a1435de3 /libreofficekit/source
parent7844323db795ed2912af0cd9c7d631ca8fc6aa4d (diff)
cid#1478187 Resource leak
Change-Id: Ib63d25e358f81c428fcbbb502650c37d016b6b44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112821 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'libreofficekit/source')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 2a4b90cc8de5..832d799b1b7a 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;
}