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 d7b1e37101789afa064e0a5094621014e2e3e013 Author: PengZheng <[email protected]> AuthorDate: Mon Apr 10 17:33:00 2023 +0800 Fix Coverity 211241 Dereference after null check. --- libs/framework/src/bundle_context.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libs/framework/src/bundle_context.c b/libs/framework/src/bundle_context.c index f4c4ad90..d2fc0a71 100644 --- a/libs/framework/src/bundle_context.c +++ b/libs/framework/src/bundle_context.c @@ -121,18 +121,11 @@ void celix_bundleContext_cleanup(celix_bundle_context_t *ctx) { } celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *out) { - celix_status_t status = CELIX_SUCCESS; - celix_bundle_t *bnd = celix_bundleContext_getBundle(context); - if (context == NULL) { - status = CELIX_ILLEGAL_ARGUMENT; - } - if (out != NULL) { - *out = bnd; + if (context == NULL || out == NULL) { + return CELIX_ILLEGAL_ARGUMENT; } - - framework_logIfError(context->framework->logger, status, NULL, "Failed to get bundle"); - - return status; + *out = celix_bundleContext_getBundle(context); + return CELIX_SUCCESS; } celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_pt *framework) {
