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 c0ece7e9d027a82f50b586717d6ca7884d499685 Author: PengZheng <[email protected]> AuthorDate: Mon Apr 10 15:50:17 2023 +0800 Fix Coverity 211171 Dereference after null check. --- libs/framework/src/bundle_context.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/libs/framework/src/bundle_context.c b/libs/framework/src/bundle_context.c index 1eb7a5ca..0ed17594 100644 --- a/libs/framework/src/bundle_context.c +++ b/libs/framework/src/bundle_context.c @@ -344,17 +344,11 @@ celix_status_t bundleContext_addServiceListener(bundle_context_pt context, celix } celix_status_t bundleContext_removeServiceListener(bundle_context_pt context, celix_service_listener_t *listener) { - celix_status_t status = CELIX_SUCCESS; - - if (context != NULL && listener != NULL) { - fw_removeServiceListener(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 service listener"); - - return status; + fw_removeServiceListener(context->framework, context->bundle, listener); + return CELIX_SUCCESS; } celix_status_t bundleContext_addBundleListener(bundle_context_pt context, bundle_listener_pt listener) {
