summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-25 20:49:55 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-01-25 20:49:55 +0000
commitede590128f9ea770f5093449fdb748ab76758883 (patch)
treeb8e1e38da99208ecb18e31a03828fac27ac74877 /cppuhelper
parent818c2021d13a24268e4bc3457141e76c008ef296 (diff)
coverity#1266445 Explicit null dereferenced
Change-Id: I2d62d6972d085fe818ec6767a0660afb010bece8
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/component_context.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx
index ed32764e9fa1..ef684e93bb36 100644
--- a/cppuhelper/source/component_context.cxx
+++ b/cppuhelper/source/component_context.cxx
@@ -741,12 +741,14 @@ void ComponentContext::disposing()
&envs, &envCount, &rtl_allocateMemory, OUString("java").pData);
assert(envCount >= 0);
assert(envCount == 0 || envs != nullptr);
- for (sal_Int32 i = 0; i != envCount; ++i) {
- assert(envs[i] != nullptr);
- assert(envs[i]->dispose != nullptr);
- (*envs[i]->dispose)(envs[i]);
+ if (envs) {
+ for (sal_Int32 i = 0; i != envCount; ++i) {
+ assert(envs[i] != nullptr);
+ assert(envs[i]->dispose != nullptr);
+ (*envs[i]->dispose)(envs[i]);
+ }
+ rtl_freeMemory(envs);
}
- rtl_freeMemory(envs);
}
ComponentContext::ComponentContext(