summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-19 15:11:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-19 18:10:13 +0000
commit746da6b7fb3829e1ca23a4b8dfec6c502bac681c (patch)
tree89bdf6ec848f13b565ae36ed3c2589a763ba2b73 /libreofficekit
parent5b05a3fa2d6873c1046a959c545db133b1974e2c (diff)
coverity#1343633 Resource leak
Change-Id: I2384091557c2a3b061e2c60118309f35b65b45d6
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5f30908208fd..55c7f78d31f7 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -334,6 +334,9 @@ static void
doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highlightAll)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
+ if (!priv->m_pDocument)
+ return;
+
boost::property_tree::ptree aTree;
GtkWidget* drawingWidget = GTK_WIDGET(pDocView);
GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget);
@@ -341,9 +344,6 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh
cairo_rectangle_int_t cairoVisRect;
int x, y;
- if (!priv->m_pDocument)
- return;
-
cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect);
x = pixelToTwip (cairoVisRect.x, priv->m_fZoom);
y = pixelToTwip (cairoVisRect.y, priv->m_fZoom);
@@ -2543,13 +2543,13 @@ SAL_DLLPUBLIC_EXPORT void
lok_doc_view_set_part (LOKDocView* pDocView, int nPart)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
+ if (!priv->m_pDocument)
+ return;
+
GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
LOEvent* pLOEvent = new LOEvent(LOK_SET_PART);
GError* error = nullptr;
- if (!priv->m_pDocument)
- return;
-
pLOEvent->m_nPart = nPart;
g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
@@ -2566,7 +2566,6 @@ SAL_DLLPUBLIC_EXPORT gchar*
lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
-
if (!priv->m_pDocument)
return nullptr;
@@ -2682,7 +2681,6 @@ lok_doc_view_post_command (LOKDocView* pDocView,
gboolean bNotifyWhenFinished)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
-
if (!priv->m_pDocument)
return;