summaryrefslogtreecommitdiff
path: root/include/salhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-08 08:45:52 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-08 07:32:49 +0000
commit4bdbfdd6426460c562746c67c29a3b5e2bef8563 (patch)
tree86cbeefa70cc8f7c2ebb2bb0a8f26ca5177c69e8 /include/salhelper
parentc022a8fd6e153ee14f3d97f147af1abdd32f47e9 (diff)
fix release in ODynamicLoader
otherwise, if the refcount goes to zero, we delete the object, and the static pointer is now pointing to freed memory. Change-Id: I0cdd303590e4e70797bfddb8b403db4d831aab04 Reviewed-on: https://gerrit.libreoffice.org/26045 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/salhelper')
-rw-r--r--include/salhelper/dynload.hxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/salhelper/dynload.hxx b/include/salhelper/dynload.hxx
index b5b16fae4638..e157c016fef6 100644
--- a/include/salhelper/dynload.hxx
+++ b/include/salhelper/dynload.hxx
@@ -147,7 +147,8 @@ public:
~ODynamicLoader()
{
if( m_pLoader )
- m_pLoader->release();
+ if (m_pLoader->release()==0)
+ m_pStaticLoader = nullptr;
}
/// Assign operator
@@ -175,7 +176,7 @@ public:
return static_cast<API*>(m_pLoader->getApi());
}
- /// cast operator, which cast to a poiner with the initialized API function structure.
+ /// cast operator, which cast to a pointer with the initialized API function structure.
API* SAL_CALL operator->() const
{
return static_cast<API*>(m_pLoader->getApi());