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 944825e1822c22eec2850024c424b47a328eada9
Author: PengZheng <[email protected]>
AuthorDate: Mon Apr 10 16:34:30 2023 +0800

    Fix Coverity 211193 Dereference after null check.
---
 libs/framework/src/bundle_context.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libs/framework/src/bundle_context.c 
b/libs/framework/src/bundle_context.c
index 4fb34142..8f9cfa82 100644
--- a/libs/framework/src/bundle_context.c
+++ b/libs/framework/src/bundle_context.c
@@ -334,17 +334,10 @@ celix_status_t 
bundleContext_removeServiceListener(bundle_context_pt context, ce
 }
 
 celix_status_t bundleContext_addBundleListener(bundle_context_pt context, 
bundle_listener_pt listener) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && listener != NULL) {
-        fw_addBundleListener(context->framework, context->bundle, listener);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
+    if (context == NULL || listener == NULL) {
+        return CELIX_ILLEGAL_ARGUMENT;
     }
-
-    framework_logIfError(context->framework->logger, status, NULL, "Failed to 
add bundle listener");
-
-    return status;
+    return fw_addBundleListener(context->framework, context->bundle, listener);
 }
 
 celix_status_t bundleContext_removeBundleListener(bundle_context_pt context, 
bundle_listener_pt listener) {

Reply via email to