From 163dd5df9f080a141e201a32c40ff80e1a5d2e34 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 3 Nov 2018 21:49:05 +0300 Subject: 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 --- chart2/source/controller/dialogs/tp_ChartType.cxx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'chart2') 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 +#include #include #include #include @@ -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()); + m_aChartTypeDialogControllerList.push_back(o3tl::make_unique()); + m_aChartTypeDialogControllerList.push_back(o3tl::make_unique()); + m_aChartTypeDialogControllerList.push_back(o3tl::make_unique()); + m_aChartTypeDialogControllerList.push_back(o3tl::make_unique()); if (bEnableComplexChartTypes) { - m_aChartTypeDialogControllerList.emplace_back(new XYChartDialogController() ); - m_aChartTypeDialogControllerList.emplace_back(new BubbleChartDialogController() ); + m_aChartTypeDialogControllerList.push_back(o3tl::make_unique()); + m_aChartTypeDialogControllerList.push_back( + o3tl::make_unique()); } - m_aChartTypeDialogControllerList.emplace_back(new NetChartDialogController() ); + m_aChartTypeDialogControllerList.push_back(o3tl::make_unique()); if (bEnableComplexChartTypes) { - m_aChartTypeDialogControllerList.emplace_back(new StockChartDialogController() ); + m_aChartTypeDialogControllerList.push_back(o3tl::make_unique()); } - m_aChartTypeDialogControllerList.emplace_back(new CombiColumnLineChartDialogController() ); + m_aChartTypeDialogControllerList.push_back( + o3tl::make_unique()); for (auto const& elem : m_aChartTypeDialogControllerList) { -- cgit