diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx index a3c9696fa142..97b5c48a1676 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx @@ -88,7 +88,6 @@ SpellChecker::~SpellChecker() } delete[] m_aDicts; } - delete[] m_aDEncs; delete[] m_aDLocs; delete[] m_aDNames; if (m_pPropHelper) @@ -200,7 +199,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales() // add dictionary information m_aDicts = new Hunspell* [m_nNumDict]; - m_aDEncs = new rtl_TextEncoding [m_nNumDict]; + m_aDEncs.reset( new rtl_TextEncoding [m_nNumDict] ); m_aDLocs = new Locale [m_nNumDict]; m_aDNames = new OUString [m_nNumDict]; k = 0; @@ -240,8 +239,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales() m_nNumDict = 0; delete[] m_aDicts; m_aDicts = nullptr; - delete[] m_aDEncs; - m_aDEncs = nullptr; + m_aDEncs.reset(); delete[] m_aDLocs; m_aDLocs = nullptr; delete[] m_aDNames; diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx b/lingucomponent/source/spellcheck/spell/sspellimp.hxx index 63b13d19b11d..3a61900e8c15 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx @@ -34,6 +34,7 @@ #include #include +#include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -55,7 +56,7 @@ class SpellChecker : { Sequence< Locale > m_aSuppLocales; Hunspell ** m_aDicts; - rtl_TextEncoding * m_aDEncs; + std::unique_ptr m_aDEncs; Locale * m_aDLocs; OUString * m_aDNames; sal_Int32 m_nNumDict;