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 c82be04c22a692eebe6b59dd508bd77db68e39b6 Author: PengZheng <[email protected]> AuthorDate: Mon Apr 10 15:42:45 2023 +0800 Fix Coverity 211170 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 807febf5..1eb7a5ca 100644 --- a/libs/framework/src/bundle_context.c +++ b/libs/framework/src/bundle_context.c @@ -209,17 +209,10 @@ celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, c } celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, const char * filter, array_list_pt *service_references) { - celix_status_t status = CELIX_SUCCESS; - - if (context != NULL && *service_references == NULL) { - fw_getServiceReferences(context->framework, service_references, context->bundle, serviceName, filter); - } else { - status = CELIX_ILLEGAL_ARGUMENT; + if (context == NULL || service_references == NULL) { + return CELIX_ILLEGAL_ARGUMENT; } - - framework_logIfError(context->framework->logger, status, NULL, "Failed to get service references"); - - return status; + return fw_getServiceReferences(context->framework, service_references, context->bundle, serviceName, filter); } celix_status_t bundleContext_getServiceReference(bundle_context_pt context, const char * serviceName, service_reference_pt *service_reference) {
