diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-07-31 21:43:59 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-07-31 22:14:25 +0200 |
commit | 3d6521280929ecacc53b7c358d29d0b5d31b3462 (patch) | |
tree | 44bc202020f1df22042ad89e493bd63f3148b649 | |
parent | 53e4b24c9ee9f2114bbc6b820ece4c469cd811d5 (diff) |
fix memory leak around function descriptions
Found by Lsan.
Change-Id: Ia443ed6eb2a20854998a615f3c2bd9fdac156a8c
-rw-r--r-- | formula/source/ui/dlg/FormulaHelper.cxx | 4 | ||||
-rw-r--r-- | include/formula/IFunctionDescription.hxx | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx index 5805778a8eac..6c999bdea0bb 100644 --- a/formula/source/ui/dlg/FormulaHelper.cxx +++ b/formula/source/ui/dlg/FormulaHelper.cxx @@ -21,6 +21,8 @@ #include <unotools/charclass.hxx> #include <unotools/syslocale.hxx> +#include <boost/scoped_ptr.hpp> + namespace formula { @@ -91,7 +93,7 @@ bool FormulaHelper::GetNextFunc( const OUString& rFormula, const sal_uInt32 nCategoryCount = m_pFunctionManager->getCount(); for(sal_uInt32 j= 0; j < nCategoryCount && !*ppFDesc; ++j) { - const IFunctionCategory* pCategory = m_pFunctionManager->getCategory(j); + boost::scoped_ptr<const IFunctionCategory> pCategory(m_pFunctionManager->getCategory(j)); const sal_uInt32 nCount = pCategory->getCount(); for(sal_uInt32 i = 0 ; i < nCount; ++i) { diff --git a/include/formula/IFunctionDescription.hxx b/include/formula/IFunctionDescription.hxx index a3570bb87071..579d36b3bc49 100644 --- a/include/formula/IFunctionDescription.hxx +++ b/include/formula/IFunctionDescription.hxx @@ -60,7 +60,7 @@ namespace formula ~IFunctionManager() {} }; - class SAL_NO_VTABLE IFunctionCategory + class IFunctionCategory { public: IFunctionCategory(){} @@ -70,8 +70,7 @@ namespace formula virtual sal_uInt32 getNumber() const = 0; virtual OUString getName() const = 0; - protected: - ~IFunctionCategory() {} + virtual ~IFunctionCategory() {} }; class SAL_NO_VTABLE IFunctionDescription |