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 e3b06738310c033065b1196d76534753a9415fc7 Author: PengZheng <[email protected]> AuthorDate: Mon Apr 10 17:29:45 2023 +0800 Fix Coverity 211240 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 a0a8d436..f4c4ad90 100644 --- a/libs/framework/src/bundle_context.c +++ b/libs/framework/src/bundle_context.c @@ -296,17 +296,10 @@ celix_status_t bundleContext_addBundleListener(bundle_context_pt context, bundle } celix_status_t bundleContext_removeBundleListener(bundle_context_pt context, bundle_listener_pt listener) { - celix_status_t status = CELIX_SUCCESS; - - if (context != NULL && listener != NULL) { - fw_removeBundleListener(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 remove bundle listener"); - - return status; + return fw_removeBundleListener(context->framework, context->bundle, listener); } celix_status_t bundleContext_addFrameworkListener(bundle_context_pt context, framework_listener_pt listener) {
