[Libreoffice-commits] core.git: chart2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Nov 3 21:03:12 UTC 2018


 chart2/source/controller/dialogs/tp_ChartType.cxx |   23 ++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 163dd5df9f080a141e201a32c40ff80e1a5d2e34
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Nov 3 21:49:05 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Nov 3 22:02:42 2018 +0100

    tdf#120703 PVS: V1023
    
    V1023 A pointer without owner is added to the 'm_aChartTypeDialogControllerList'
          container by the 'emplace_back' method. A memory leak will occur in case
          of an exception.
    
    Change-Id: I35bf344fd083c6a1717a150f78370ec59f206240
    Reviewed-on: https://gerrit.libreoffice.org/62821
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 75f8a76ff5f8..e80e2303e433 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -28,6 +28,7 @@
 
 #include <svtools/controldims.hxx>
 
+#include <o3tl/make_unique.hxx>
 #include <vcl/weld.hxx>
 #include <tools/diagnose_ex.h>
 #include <sal/log.hxx>
@@ -654,22 +655,24 @@ ChartTypeTabPage::ChartTypeTabPage(TabPageParent pParent , const uno::Reference<
         }
     }
 
-    m_aChartTypeDialogControllerList.emplace_back(new ColumnChartDialogController() );
-    m_aChartTypeDialogControllerList.emplace_back(new BarChartDialogController() );
-    m_aChartTypeDialogControllerList.emplace_back(new PieChartDialogController() );
-    m_aChartTypeDialogControllerList.emplace_back(new AreaChartDialogController() );
-    m_aChartTypeDialogControllerList.emplace_back(new LineChartDialogController() );
+    m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<ColumnChartDialogController>());
+    m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<BarChartDialogController>());
+    m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<PieChartDialogController>());
+    m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<AreaChartDialogController>());
+    m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<LineChartDialogController>());
     if (bEnableComplexChartTypes)
     {
-        m_aChartTypeDialogControllerList.emplace_back(new XYChartDialogController() );
-        m_aChartTypeDialogControllerList.emplace_back(new BubbleChartDialogController() );
+        m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<XYChartDialogController>());
+        m_aChartTypeDialogControllerList.push_back(
+            o3tl::make_unique<BubbleChartDialogController>());
     }
-    m_aChartTypeDialogControllerList.emplace_back(new NetChartDialogController() );
+    m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<NetChartDialogController>());
     if (bEnableComplexChartTypes)
     {
-        m_aChartTypeDialogControllerList.emplace_back(new StockChartDialogController() );
+        m_aChartTypeDialogControllerList.push_back(o3tl::make_unique<StockChartDialogController>());
     }
-    m_aChartTypeDialogControllerList.emplace_back(new CombiColumnLineChartDialogController() );
+    m_aChartTypeDialogControllerList.push_back(
+        o3tl::make_unique<CombiColumnLineChartDialogController>());
 
     for (auto const& elem : m_aChartTypeDialogControllerList)
     {


More information about the Libreoffice-commits mailing list