This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch hotfix/coverity_fix
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 0e834c01ab2f33f21d1778719c44487c3a5fa960
Author: PengZheng <[email protected]>
AuthorDate: Mon Apr 10 15:29:30 2023 +0800

    Fix Coverity 188767: explicit null dereferenced.
---
 libs/framework/src/bundle_context.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libs/framework/src/bundle_context.c 
b/libs/framework/src/bundle_context.c
index acb7000c..be7bac8b 100644
--- a/libs/framework/src/bundle_context.c
+++ b/libs/framework/src/bundle_context.c
@@ -632,10 +632,7 @@ celix_dependency_manager_t* 
celix_bundleContext_getDependencyManager(bundle_cont
 static celix_status_t bundleContext_bundleChanged(void *listenerSvc, 
bundle_event_t *event) {
     celix_status_t status = CELIX_SUCCESS;
     bundle_listener_t *listener = listenerSvc;
-    celix_bundle_context_bundle_tracker_entry_t *tracker = NULL;
-    if (listener != NULL) {
-        tracker = listener->handle;
-    }
+    celix_bundle_context_bundle_tracker_entry_t *tracker = listener->handle;
 
     bool handleEvent = true;
     long bndId = celix_bundle_getId(event->bnd);
@@ -643,7 +640,7 @@ static celix_status_t bundleContext_bundleChanged(void 
*listenerSvc, bundle_even
         handleEvent = tracker->opts.includeFrameworkBundle;
     }
 
-    if (tracker != NULL && handleEvent) {
+    if (handleEvent) {
         void *callbackHandle = tracker->opts.callbackHandle;
 
         if (event->type == OSGI_FRAMEWORK_BUNDLE_EVENT_INSTALLED && 
tracker->opts.onInstalled != NULL) {

Reply via email to