celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [33/51] celix git commit: CELIX-77: fixed several memory issues
Date Mon, 25 Jan 2016 18:01:49 GMT
CELIX-77: fixed several memory issues


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5834d633
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5834d633
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5834d633

Branch: refs/heads/feature/CELIX-335_deploy_refactoring
Commit: 5834d633c1873477afab35c51c7109691c152fef
Parents: a10eef6
Author: Bjoern Petri <bpetri@apache.org>
Authored: Thu Jan 14 18:39:29 2016 +0100
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Thu Jan 14 18:39:29 2016 +0100

----------------------------------------------------------------------
 .../config_admin_tst/config_admin_test.cpp      |  4 +--
 .../include/example_managed_service_impl.h      |  3 +-
 .../example_test/private/src/activator.c        | 23 ++++++++--------
 .../private/src/example_managed_service_impl.c  | 10 +++++--
 .../include/example2_managed_service_impl.h     |  3 +-
 .../example_test2/private/src/activator.c       | 20 ++++++++------
 .../private/src/example_managed_service_impl.c  |  7 ++++-
 .../include/configuration_admin_factory.h       |  2 +-
 .../private/include/configuration_admin_impl.h  |  2 +-
 .../private/include/configuration_impl.h        |  2 +-
 .../private/include/configuration_store.h       |  2 +-
 .../service/private/include/framework_patch.h   |  2 +-
 .../private/include/managed_service_tracker.h   |  2 +-
 .../private/include/updated_thread_pool.h       |  2 +-
 config_admin/service/private/src/activator.c    | 15 +++++++---
 .../private/src/configuration_admin_factory.c   |  5 +++-
 .../private/src/configuration_admin_impl.c      |  2 +-
 .../service/private/src/configuration_impl.c    | 14 ++++++----
 .../service/private/src/configuration_store.c   | 29 ++++++++++----------
 .../service/private/src/managed_service_impl.c  |  4 +--
 .../private/src/managed_service_tracker.c       |  4 ++-
 .../service/private/src/updated_thread_pool.c   |  6 ++--
 .../service/public/include/configuration.h      |  2 +-
 .../public/include/configuration_admin.h        |  2 +-
 .../public/include/configuration_event.h        |  2 +-
 .../public/include/configuration_listener.h     |  2 +-
 .../public/include/configuration_plugin.h       |  2 +-
 .../service/public/include/managed_service.h    |  4 +--
 28 files changed, 105 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/config_admin_test.cpp
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/config_admin_test.cpp b/config_admin/config_admin_tst/config_admin_test.cpp
index 8215f15..acb6359 100644
--- a/config_admin/config_admin_tst/config_admin_test.cpp
+++ b/config_admin/config_admin_tst/config_admin_test.cpp
@@ -17,10 +17,10 @@
  *under the License.
  */
 /*
- * array_list_test.cpp
+ * config_admin_test.cpp
  *
  * 	\date       Sep 15, 2015
- *  \author    	Menno van der Graaf & Alexander
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 #include <stdio.h>

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
index 6f94994..c34647f 100644
--- a/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
+++ b/config_admin/config_admin_tst/example_test/private/include/example_managed_service_impl.h
@@ -20,7 +20,7 @@
  * example_managed_service_impl.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -61,6 +61,7 @@ typedef struct tst_service *tst_service_pt;
 
 celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
 celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance);
 
 
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/activator.c b/config_admin/config_admin_tst/example_test/private/src/activator.c
index 4adfcaa..2507e4e 100644
--- a/config_admin/config_admin_tst/example_test/private/src/activator.c
+++ b/config_admin/config_admin_tst/example_test/private/src/activator.c
@@ -20,7 +20,7 @@
  * activator.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -52,9 +52,8 @@ struct activator {
 	tst_service_pt           tstServ;
 	service_registration_pt  tstReg;
 
-//	struct managed_service mgmServ;
     service_registration_pt   mgmReg;
-	managed_service_pt		  mgmServ;
+	managed_service_service_pt  mgmServ;
 
 	service_reference_pt	  configAdminServRef;
 	configuration_admin_service_pt   configAdminServ;
@@ -131,30 +130,31 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt
ctx) {
 				act->configAdminServ = confAdminServ;
 				act->configAdminServRef = ref;
 
-				status = managedServiceImpl_create(ctx, &act->mgmServ);
+				managed_service_pt managedService;
+				status = managedServiceImpl_create(ctx, &managedService);
 				if (status != CELIX_SUCCESS){
 					return status;
 				}
-				struct test_managed_service *test_msp = (struct test_managed_service*)act->mgmServ;
+				struct test_managed_service *test_msp = (struct test_managed_service*) managedService;
 				test_msp->handle = act;
 				test_msp->store_props = store_properties;
 
-				managed_service_service_pt managedService;
-				status = managedService_create(ctx, &managedService);
+				status = managedService_create(ctx, &act->mgmServ);
+
 				if (status != CELIX_SUCCESS){
 					return status;
 				}
 
-				managedService->managedService = act->mgmServ;
-				managedService->updated = managedServiceImpl_updated;
+				act->mgmServ->managedService = managedService;
+				act->mgmServ->updated = managedServiceImpl_updated;
+
 				configuration->configuration_getProperties(configuration->handle, &dictionary);
 				if (dictionary == NULL) {
 					dictionary = properties_create();
 					properties_set(dictionary, (char *) OSGI_FRAMEWORK_SERVICE_PID, pid);
 					properties_set(dictionary, (char *) "type", (char*)"default_value");
 				}
-				status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
-						managedService, dictionary, &act->mgmReg);
+				status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME, act->mgmServ,
dictionary, &act->mgmReg);
 				if (status != CELIX_SUCCESS){
 					printf("[ ERROR ]: Managed Service not registered \n");
 					return status;
@@ -186,6 +186,7 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt
context)
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
 	struct activator *act = (struct activator *)userData;
+	managedServiceImpl_destroy(&act->mgmServ->managedService);
 	managedService_destroy(act->mgmServ);
 	free(act->tstServ);
 	free(act);

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
index 02d5df5..309cc7a 100644
--- a/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
+++ b/config_admin/config_admin_tst/example_test/private/src/example_managed_service_impl.c
@@ -20,7 +20,7 @@
  * example_managed_service_impl.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -32,7 +32,7 @@
 
 /* ------------------------ Constructor -------------------------------------*/
 
-celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance){
+celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance)
{
 
 	celix_status_t status = CELIX_SUCCESS;
 
@@ -52,6 +52,12 @@ celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_serv
 }
 
 
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance) {
+    free(*instance);
+
+    return CELIX_SUCCESS;
+}
+
 /* -------------------- Implementation --------------------------------------*/
 
 celix_status_t managedServiceImpl_updated(managed_service_pt managedService, properties_pt
properties){

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
index 8292721..ab63215 100644
--- a/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
+++ b/config_admin/config_admin_tst/example_test2/private/include/example2_managed_service_impl.h
@@ -20,7 +20,7 @@
  * example_managed_service_impl.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -59,6 +59,7 @@ typedef struct tst2_service *tst2_service_pt;
 
 celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_service_pt *instance);
 celix_status_t managedServiceImpl_updated(managed_service_pt instance, properties_pt properties);
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance);
 
 
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test2/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/activator.c b/config_admin/config_admin_tst/example_test2/private/src/activator.c
index 400c63c..a5ff343 100644
--- a/config_admin/config_admin_tst/example_test2/private/src/activator.c
+++ b/config_admin/config_admin_tst/example_test2/private/src/activator.c
@@ -20,7 +20,7 @@
  * activator.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -53,7 +53,8 @@ struct activator {
 	service_registration_pt  tstReg;
 
     service_registration_pt   mgmReg;
-	managed_service_pt		  mgmServ;
+    managed_service_service_pt  mgmServ;
+
 
 	service_reference_pt	  configAdminServRef;
 	configuration_admin_service_pt   configAdminServ;
@@ -124,19 +125,19 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt
ctx) {
 				act->configAdminServ = confAdminServ;
 				act->configAdminServRef = ref;
 
-				status = managedServiceImpl_create(ctx, &act->mgmServ);
+			    managed_service_pt managedService;
+				status = managedServiceImpl_create(ctx, &managedService);
 				if (status != CELIX_SUCCESS){
 					return status;
 				}
 
-				managed_service_service_pt managedService;
-				status = managedService_create(ctx, &managedService);
+				status = managedService_create(ctx, &act->mgmServ);
 				if (status != CELIX_SUCCESS){
 					return status;
 				}
 
-				managedService->managedService = act->mgmServ;
-				managedService->updated = managedServiceImpl_updated;
+				act->mgmServ->managedService = managedService;
+				act->mgmServ->updated = managedServiceImpl_updated;
 
 				properties_pt dictionary;
 				dictionary = properties_create();
@@ -144,7 +145,7 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt
ctx) {
 				properties_set(dictionary, (char *) "type", (char*)"test2_default_value");
 
 				status = bundleContext_registerService(ctx, (char *) MANAGED_SERVICE_SERVICE_NAME,
-						managedService, dictionary, &act->mgmReg);
+				        act->mgmServ, dictionary, &act->mgmReg);
 				if (status != CELIX_SUCCESS){
 					printf("[ ERROR ]: Managed Service not registered \n");
 					return status;
@@ -206,7 +207,8 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt
context)
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
 	struct activator *act = (struct activator *)userData;
-	managedService_destroy(act->mgmServ);
+    managedServiceImpl_destroy(&act->mgmServ->managedService);
+    managedService_destroy(act->mgmServ);
 	free(act->tstServ);
 	free(act);
 	return CELIX_SUCCESS;

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
index 270e705..249bc66 100644
--- a/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
+++ b/config_admin/config_admin_tst/example_test2/private/src/example_managed_service_impl.c
@@ -20,7 +20,7 @@
  * example_managed_service_impl.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -60,6 +60,11 @@ celix_status_t managedServiceImpl_create(bundle_context_pt context, managed_serv
 	return status;
 }
 
+celix_status_t managedServiceImpl_destroy(managed_service_pt *instance) {
+    free(*instance);
+
+    return CELIX_SUCCESS;
+}
 
 /* -------------------- Implementation --------------------------------------*/
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_admin_factory.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_admin_factory.h b/config_admin/service/private/include/configuration_admin_factory.h
index d86ea78..a7c79d8 100644
--- a/config_admin/service/private/include/configuration_admin_factory.h
+++ b/config_admin/service/private/include/configuration_admin_factory.h
@@ -20,7 +20,7 @@
  * configuration_admin_factory.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_admin_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_admin_impl.h b/config_admin/service/private/include/configuration_admin_impl.h
index 08932ed..be79602 100644
--- a/config_admin/service/private/include/configuration_admin_impl.h
+++ b/config_admin/service/private/include/configuration_admin_impl.h
@@ -20,7 +20,7 @@
  * configuration_admin_impl.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_impl.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_impl.h b/config_admin/service/private/include/configuration_impl.h
index 71a488c..e8a0acd 100644
--- a/config_admin/service/private/include/configuration_impl.h
+++ b/config_admin/service/private/include/configuration_impl.h
@@ -20,7 +20,7 @@
  * configuration_impl.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/configuration_store.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/configuration_store.h b/config_admin/service/private/include/configuration_store.h
index e5f9a8c..824ff63 100644
--- a/config_admin/service/private/include/configuration_store.h
+++ b/config_admin/service/private/include/configuration_store.h
@@ -20,7 +20,7 @@
  * configuration_store.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/framework_patch.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/framework_patch.h b/config_admin/service/private/include/framework_patch.h
index 13ffeae..32200b5 100644
--- a/config_admin/service/private/include/framework_patch.h
+++ b/config_admin/service/private/include/framework_patch.h
@@ -20,7 +20,7 @@
  * framework_patch.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/managed_service_tracker.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/managed_service_tracker.h b/config_admin/service/private/include/managed_service_tracker.h
index c29ea6a..9ce4516 100644
--- a/config_admin/service/private/include/managed_service_tracker.h
+++ b/config_admin/service/private/include/managed_service_tracker.h
@@ -20,7 +20,7 @@
  * managed_service_tracker.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/include/updated_thread_pool.h
----------------------------------------------------------------------
diff --git a/config_admin/service/private/include/updated_thread_pool.h b/config_admin/service/private/include/updated_thread_pool.h
index 3dac3a2..ce1e6b6 100644
--- a/config_admin/service/private/include/updated_thread_pool.h
+++ b/config_admin/service/private/include/updated_thread_pool.h
@@ -20,7 +20,7 @@
  * updated_thread_pool.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/activator.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/activator.c b/config_admin/service/private/src/activator.c
index 0cc432c..2f94efa 100644
--- a/config_admin/service/private/src/activator.c
+++ b/config_admin/service/private/src/activator.c
@@ -20,7 +20,7 @@
  * activator.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -44,6 +44,7 @@
 struct config_admin_bundle {
 	bundle_context_pt context;
 	service_registration_pt configAdminFactoryReg;
+    service_factory_pt configAdminFactory;
 	configuration_admin_factory_pt configAdminFactoryInstance;
 };
 
@@ -81,14 +82,13 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt
context)
 
 	config_admin_bundle_t bi = (config_admin_bundle_t) userData;
 
-	service_factory_pt configAdminFactory;
 
-	status = configurationAdminFactory_create(bi->context, &configAdminFactory, &bi->configAdminFactoryInstance);
+	status = configurationAdminFactory_create(bi->context, &bi->configAdminFactory,
&bi->configAdminFactoryInstance);
 	if (status != CELIX_SUCCESS){
 		return status;
 	}
 
-	status = bundleContext_registerServiceFactory(bi->context, (char *) CONFIGURATION_ADMIN_SERVICE_NAME,
configAdminFactory, NULL, &bi->configAdminFactoryReg);
+	status = bundleContext_registerServiceFactory(bi->context, (char *) CONFIGURATION_ADMIN_SERVICE_NAME,
bi->configAdminFactory, NULL, &bi->configAdminFactoryReg);
 	if (status != CELIX_SUCCESS){
 		return status;
 	}
@@ -113,11 +113,18 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt
context)
 	configurationAdminFactory_destroy(context, bi->configAdminFactoryInstance);
 
 	bi->configAdminFactoryReg = NULL;
+    free(bi->configAdminFactory);
+
 
 	return status;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+
+    config_admin_bundle_t bi = (config_admin_bundle_t) userData;
+
+    free(bi);
+
 	return CELIX_SUCCESS;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_admin_factory.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_factory.c b/config_admin/service/private/src/configuration_admin_factory.c
index 99afbc0..1c821ea 100644
--- a/config_admin/service/private/src/configuration_admin_factory.c
+++ b/config_admin/service/private/src/configuration_admin_factory.c
@@ -20,7 +20,7 @@
  * configuration_admin_factory.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -149,6 +149,9 @@ celix_status_t configurationAdminFactory_getService(void *handle, bundle_pt
bund
 
 celix_status_t configurationAdminFactory_ungetService(void *factory, bundle_pt bundle, service_registration_pt
registration, void **service){
 	// do nothing
+
+    free(*service);
+
 	return CELIX_SUCCESS;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_admin_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_admin_impl.c b/config_admin/service/private/src/configuration_admin_impl.c
index 5bda485..eb8cb06 100644
--- a/config_admin/service/private/src/configuration_admin_impl.c
+++ b/config_admin/service/private/src/configuration_admin_impl.c
@@ -20,7 +20,7 @@
  * configuration_admin_impl.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_impl.c b/config_admin/service/private/src/configuration_impl.c
index 9462a9a..f39dfa0 100644
--- a/config_admin/service/private/src/configuration_impl.c
+++ b/config_admin/service/private/src/configuration_impl.c
@@ -20,7 +20,7 @@
  * configuration_impl.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -635,7 +635,9 @@ celix_status_t configuration_setAutoProperties(configuration_impl_pt configurati
 	configuration_lock(configuration);
 
 	// (2) set service.pid
-	properties_set(*properties, (char*)OSGI_FRAMEWORK_SERVICE_PID, configuration->pid);
+    if (properties_get(*properties, (char*)OSGI_FRAMEWORK_SERVICE_PID) != NULL) {
+        properties_set(*properties, (char*)OSGI_FRAMEWORK_SERVICE_PID, configuration->pid);
+    }
 
 	// (3) set factory.pid
 	if ( configuration->factoryPid != NULL ){
@@ -660,17 +662,17 @@ celix_status_t configuration_setAutoProperties(configuration_impl_pt
configurati
 
 celix_status_t configuration_setBundleLocationProperty(configuration_impl_pt configuration,
properties_pt *properties){
 
-	char *boundLocation;
+	char *bundleLocation;
 
 	configuration_lock(configuration);
 
-	if( configuration_getBundleLocation(configuration, &boundLocation) != CELIX_SUCCESS
){
+	if( configuration_getBundleLocation(configuration, &bundleLocation) != CELIX_SUCCESS
){
 		configuration_unlock(configuration);
 		return CELIX_ILLEGAL_ARGUMENT;
 	}
 
-	if ( boundLocation != NULL ){
-		properties_set(*properties, (char*)SERVICE_BUNDLELOCATION, boundLocation);
+	if ( bundleLocation != NULL ) {
+		properties_set(*properties, (char*)SERVICE_BUNDLELOCATION, bundleLocation);
 	}
 
 	configuration_unlock(configuration);

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/configuration_store.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/configuration_store.c b/config_admin/service/private/src/configuration_store.c
index 1343568..cee51e5 100644
--- a/config_admin/service/private/src/configuration_store.c
+++ b/config_admin/service/private/src/configuration_store.c
@@ -20,7 +20,7 @@
  * configuration_store.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -151,6 +151,7 @@ celix_status_t configurationStore_saveConfiguration(configuration_store_pt
store
 
     //(5) configStore.writeFile(file,properties)
     status = configurationStore_writeConfigurationFile(configFile, configProperties);
+
     if (status != CELIX_SUCCESS) {
         return status;
     }
@@ -247,17 +248,17 @@ celix_status_t configurationStore_writeConfigurationFile(int file, properties_pt
     }
     // size >0
 
-    char buffer[128];
+    char buffer[256];
 
     hash_map_iterator_pt iterator = hashMapIterator_create(properties);
     while (hashMapIterator_hasNext(iterator)) {
 
         hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
 
-        strcpy(buffer, hashMapEntry_getKey(entry));
-        strcat(buffer, "=");
-        strcat(buffer, hashMapEntry_getValue(entry));
-        strcat(buffer, "\n");
+        char* key = hashMapEntry_getKey(entry);
+        char* val = hashMapEntry_getValue(entry);
+
+        snprintf(buffer, 256, "%s=%s", key, val);
 
         int buffLength = strlen((const char *) buffer);
 
@@ -333,7 +334,7 @@ celix_status_t configurationStore_readCache(configuration_store_pt store)
{
 
 celix_status_t configurationStore_readConfigurationFile(const char *name, int size, properties_pt
*dictionary) {
 
-    char *fname;		// file name
+    char fname[256];		// file name
     char *buffer;		// file buffer
     int fd;
     celix_status_t status = CELIX_SUCCESS;
@@ -341,9 +342,7 @@ celix_status_t configurationStore_readConfigurationFile(const char *name,
int si
     properties_pt properties = NULL;
 
     // (1) The full path to the file
-    fname = strdup((const char *) STORE_DIR);
-    strcat(fname, strdup("/"));
-    strcat(fname, strdup(name));
+    snprintf(fname, 256, "%s/%s", STORE_DIR, name);
 
     // (2) pool.new
 
@@ -355,7 +354,7 @@ celix_status_t configurationStore_readConfigurationFile(const char *name,
int si
     }
 
     // (4) buffer.new
-    buffer = calloc(1, size);
+    buffer = calloc(1, size+1);
     if (!buffer) {
         close(fd);
         return CELIX_ENOMEM;
@@ -382,26 +381,28 @@ celix_status_t configurationStore_parseDataConfigurationFile(char *data,
propert
 
     properties_pt properties = properties_create();
 
+
     char *token;
     char *key;
     char *value;
+    char *saveptr;
 
     bool isKey = true;
-    token = strtok(data, "=");
+    token = strtok_r(data, "=", &saveptr);
 
     while (token != NULL) {
 
         if (isKey) {
             key = strdup(token);
             isKey = false;
+
         } else { // isValue
             value = strdup(token);
             properties_set(properties, key, value);
             isKey = true;
         }
 
-        token = strtok(NULL, "=\n");
-
+        token = strtok_r(NULL, "=\n", &saveptr);
     }
 
     if (hashMap_isEmpty(properties)) {

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/managed_service_impl.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_impl.c b/config_admin/service/private/src/managed_service_impl.c
index 243a57e..3909979 100644
--- a/config_admin/service/private/src/managed_service_impl.c
+++ b/config_admin/service/private/src/managed_service_impl.c
@@ -20,7 +20,7 @@
  * managed_service_impl.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -49,7 +49,7 @@ celix_status_t managedService_create(bundle_context_pt context, managed_service_
 
 }
 
-celix_status_t managedService_destroy(managed_service_pt service) {
+celix_status_t managedService_destroy(managed_service_service_pt service) {
 	free(service);
 	return CELIX_SUCCESS;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/managed_service_tracker.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/managed_service_tracker.c b/config_admin/service/private/src/managed_service_tracker.c
index 0e47ec0..642f1aa 100644
--- a/config_admin/service/private/src/managed_service_tracker.c
+++ b/config_admin/service/private/src/managed_service_tracker.c
@@ -20,7 +20,7 @@
  * managed_service_tracker.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -182,6 +182,8 @@ celix_status_t managedServiceTracker_destroy(bundle_context_pt context,
managed_
 	updatedThreadPool_destroy(mgServTr->updatedThreadPool);
 	celixThreadMutex_destroy(&mgServTr->managedServicesReferencesMutex);
 	serviceTracker_destroy(tracker);
+    free(mgServTr);
+
 	return CELIX_SUCCESS;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/private/src/updated_thread_pool.c
----------------------------------------------------------------------
diff --git a/config_admin/service/private/src/updated_thread_pool.c b/config_admin/service/private/src/updated_thread_pool.c
index 922bd26..86220db 100644
--- a/config_admin/service/private/src/updated_thread_pool.c
+++ b/config_admin/service/private/src/updated_thread_pool.c
@@ -20,7 +20,7 @@
  * updated_thread_pool.c
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -123,14 +123,16 @@ void *updateThreadPool_updatedCallback(void *data) {
 
 	(*managedServiceService->updated)(managedServiceService->managedService, properties);
 
+	free(data);
+
 	return NULL;
 
 }
 
 celix_status_t updatedThreadPool_wrapDataCallback(managed_service_service_pt service, properties_pt
properties, data_callback_t *data){
 
-
 	*data = calloc(1, sizeof(**data));
+
 	if (!*data){
 		printf("[ ERROR ]: UpdatedThreadPool - WrapDataCallback (Data not initialized) \n");
 		return CELIX_ENOMEM;

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration.h b/config_admin/service/public/include/configuration.h
index f25af23..74bf5b1 100644
--- a/config_admin/service/public/include/configuration.h
+++ b/config_admin/service/public/include/configuration.h
@@ -20,7 +20,7 @@
  * configuration.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_admin.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_admin.h b/config_admin/service/public/include/configuration_admin.h
index 09ad096..0a8983c 100644
--- a/config_admin/service/public/include/configuration_admin.h
+++ b/config_admin/service/public/include/configuration_admin.h
@@ -20,7 +20,7 @@
  * configuration_admin.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_event.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_event.h b/config_admin/service/public/include/configuration_event.h
index 38b79d1..3fbae52 100644
--- a/config_admin/service/public/include/configuration_event.h
+++ b/config_admin/service/public/include/configuration_event.h
@@ -20,7 +20,7 @@
  * configuration_event.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_listener.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_listener.h b/config_admin/service/public/include/configuration_listener.h
index 3a635e6..a25a70d 100644
--- a/config_admin/service/public/include/configuration_listener.h
+++ b/config_admin/service/public/include/configuration_listener.h
@@ -20,7 +20,7 @@
  * configuration_listener.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/configuration_plugin.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/configuration_plugin.h b/config_admin/service/public/include/configuration_plugin.h
index 2175104..d523326 100644
--- a/config_admin/service/public/include/configuration_plugin.h
+++ b/config_admin/service/public/include/configuration_plugin.h
@@ -20,7 +20,7 @@
  * configuration_plugin.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/celix/blob/5834d633/config_admin/service/public/include/managed_service.h
----------------------------------------------------------------------
diff --git a/config_admin/service/public/include/managed_service.h b/config_admin/service/public/include/managed_service.h
index b666e51..1067760 100644
--- a/config_admin/service/public/include/managed_service.h
+++ b/config_admin/service/public/include/managed_service.h
@@ -20,7 +20,7 @@
  * managed_service.h
  *
  *  \date       Aug 12, 2013
- *  \author    	<a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project
Team</a>
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
  *  \copyright	Apache License, Version 2.0
  */
 
@@ -49,6 +49,6 @@ struct managed_service_service{
 };
 
 celix_status_t managedService_create(bundle_context_pt context, managed_service_service_pt
*service);
-celix_status_t managedService_destroy(managed_service_pt service);
+celix_status_t managedService_destroy(managed_service_service_pt service);
 
 #endif /* MANAGED_SERVICE_H_ */


Mime
View raw message