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

    Fix Coverity 211187 Dereference after null check.
---
 libs/framework/src/bundle_context.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/libs/framework/src/bundle_context.c 
b/libs/framework/src/bundle_context.c
index f1b3c534..4fb34142 100644
--- a/libs/framework/src/bundle_context.c
+++ b/libs/framework/src/bundle_context.c
@@ -136,17 +136,11 @@ celix_status_t bundleContext_getBundle(bundle_context_pt 
context, bundle_pt *out
 }
 
 celix_status_t bundleContext_getFramework(bundle_context_pt context, 
framework_pt *framework) {
-       celix_status_t status = CELIX_SUCCESS;
-
-       if (context == NULL) {
-               status = CELIX_ILLEGAL_ARGUMENT;
-       } else {
-               *framework = context->framework;
-       }
-
-       framework_logIfError(context->framework->logger, status, NULL, "Failed 
to get framework");
-
-       return status;
+    if (context == NULL || framework == NULL) {
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
+    *framework = context->framework;
+    return CELIX_SUCCESS;
 }
 
 celix_status_t bundleContext_installBundle(bundle_context_pt context, const 
char * location, bundle_pt *bundle) {

Reply via email to