You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2018/04/19 10:34:16 UTC
celix git commit: CELIX-446: Some fixes based on the coverity scan
Repository: celix
Updated Branches:
refs/heads/develop 333707934 -> e17f8e6ac
CELIX-446: Some fixes based on the coverity scan
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/e17f8e6a
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/e17f8e6a
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/e17f8e6a
Branch: refs/heads/develop
Commit: e17f8e6aca4e1a1bc220f6e3d1cbf92cdd882823
Parents: 3337079
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Apr 19 12:27:04 2018 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Apr 19 12:27:04 2018 +0200
----------------------------------------------------------------------
framework/src/bundle_context.c | 4 +---
framework/src/service_tracker.c | 5 +++--
2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/e17f8e6a/framework/src/bundle_context.c
----------------------------------------------------------------------
diff --git a/framework/src/bundle_context.c b/framework/src/bundle_context.c
index fc0e5b3..569691a 100644
--- a/framework/src/bundle_context.c
+++ b/framework/src/bundle_context.c
@@ -59,8 +59,6 @@ celix_status_t bundleContext_destroy(bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
if (context != NULL) {
- celixThreadMutex_lock(&context->mutex);
-
//NOTE still present service registartion will be cleared during bundle stop in the
//service registry (serviceRegistry_clearServiceRegistrations).
celixThreadMutex_destroy(&context->mutex);
@@ -458,8 +456,8 @@ bool bundleContext_useServiceWithId(
snprintf(filter, 64, "(%s=%li)", OSGI_FRAMEWORK_SERVICE_ID, serviceId);
service_tracker_t *trk = NULL;
serviceTracker_createWithFilter(ctx, filter, NULL, &trk);
- serviceTracker_open(trk);
if (trk != NULL) {
+ serviceTracker_open(trk);
bundle_t *bnd = NULL;
properties_t *props = NULL;
void *svc = serviceTracker_lockAndGetService(trk, &props, &bnd);
http://git-wip-us.apache.org/repos/asf/celix/blob/e17f8e6a/framework/src/service_tracker.c
----------------------------------------------------------------------
diff --git a/framework/src/service_tracker.c b/framework/src/service_tracker.c
index bc94599..402de5d 100644
--- a/framework/src/service_tracker.c
+++ b/framework/src/service_tracker.c
@@ -254,7 +254,7 @@ void* serviceTracker_lockAndGetService(service_tracker_t *tracker, properties_t
*svcPropsOut = highest->properties;
}
if (highest != NULL && ownerOut != NULL) {
- *ownerOut = tracked->serviceOwner;
+ *ownerOut = highest->serviceOwner;
}
return result;
}
@@ -472,9 +472,10 @@ static celix_status_t serviceTracker_untrack(service_tracker_pt tracker, service
celixThreadRwlock_unlock(&tracker->lock);
if (found != NULL) {
- celixThreadMutex_lock(&found->getLock);
+ celixThreadMutex_lock(&found->getLock);
serviceTracker_invokeRemovingService(tracker, found->reference, found->service);
bundleContext_ungetServiceReference(tracker->context, reference);
+ celixThreadMutex_unlock(&found->getLock);
celixThreadMutex_destroy(&found->getLock);
free(found);
}