diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-08-21 13:12:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-08-21 15:25:27 +0100 |
commit | 4b313d803279900f86992eb0aced91fb593e4355 (patch) | |
tree | 34fb9bd08f5da77776200f81d8ae49300a60b780 | |
parent | 782dffe709158b1060a29f2882c8b72fe221bb7b (diff) |
coverity#1371452 Wrapper object use after free
have another stab at silencing that
Change-Id: Ia3fe1c072bd8062a13991bbb2eca008264450138
-rw-r--r-- | filter/source/xsltfilter/LibXSLTTransformer.cxx | 2 | ||||
-rw-r--r-- | filter/source/xsltfilter/OleHandler.hxx | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index 743a84169604..239a9a2dba05 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -298,7 +298,7 @@ namespace XSLT if (styleSheet) { m_tcontext = xsltNewTransformContext(styleSheet, doc); - m_tcontext->_private = static_cast<void *> (oh.get()); + oh->registercontext(m_tcontext); xsltQuoteUserParams(m_tcontext, ¶ms[0]); result = xsltApplyStylesheetUser(styleSheet, doc, nullptr, nullptr, nullptr, m_tcontext); diff --git a/filter/source/xsltfilter/OleHandler.hxx b/filter/source/xsltfilter/OleHandler.hxx index bf83d11cd766..af8dac9fc97c 100644 --- a/filter/source/xsltfilter/OleHandler.hxx +++ b/filter/source/xsltfilter/OleHandler.hxx @@ -57,16 +57,30 @@ namespace XSLT class OleHandler { public: - OleHandler(const css::uno::Reference<XComponentContext>& rxContext){ - m_xContext = rxContext; + OleHandler(const css::uno::Reference<XComponentContext>& rxContext) + : m_xContext(rxContext) + , m_tcontext(nullptr) + { + } + ~OleHandler() + { + if (m_tcontext) + m_tcontext->_private = nullptr; } void SAL_CALL insertByName(const OUString& streamName, const OString& content); const OString SAL_CALL getByName(const OUString& streamName); + void registercontext(xsltTransformContextPtr context) + { + assert(context); + m_tcontext = context; + m_tcontext->_private = this; + } private: css::uno::Reference<XComponentContext> m_xContext; css::uno::Reference<XNameContainer> m_storage; css::uno::Reference<XStream> m_rootStream; + xsltTransformContextPtr m_tcontext; void SAL_CALL ensureCreateRootStorage(); OString SAL_CALL encodeSubStorage(const OUString& streamName); @@ -76,5 +90,6 @@ namespace XSLT }; } - #endif // INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |