celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject celix git commit: CELIX-292: fixed memory leak in refactored shell
Date Mon, 16 Nov 2015 08:21:55 GMT
Repository: celix
Updated Branches:
  refs/heads/develop a826a0dc1 -> 23140b460


CELIX-292: fixed memory leak in refactored shell


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

Branch: refs/heads/develop
Commit: 23140b4602ebf401a89cf5003f4df6cb13a4d03e
Parents: a826a0d
Author: Bjoern Petri <bpetri@apache.org>
Authored: Mon Nov 16 09:21:33 2015 +0100
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Mon Nov 16 09:21:33 2015 +0100

----------------------------------------------------------------------
 log_service/public/src/log_helper.c | 4 +++-
 shell/private/src/activator.c       | 2 ++
 shell/private/src/shell.c           | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/23140b46/log_service/public/src/log_helper.c
----------------------------------------------------------------------
diff --git a/log_service/public/src/log_helper.c b/log_service/public/src/log_helper.c
index 69ea3eb..91554a9 100644
--- a/log_service/public/src/log_helper.c
+++ b/log_service/public/src/log_helper.c
@@ -136,7 +136,9 @@ celix_status_t logHelper_stop(log_helper_pt loghelper) {
 celix_status_t logHelper_destroy(log_helper_pt* loghelper) {
         celix_status_t status = CELIX_SUCCESS;
 
-        serviceTracker_destroy((*loghelper)->logServiceTracker);
+        if((*loghelper)->logServiceTracker){
+      		serviceTracker_destroy((*loghelper)->logServiceTracker);
+        }
 
         pthread_mutex_lock(&(*loghelper)->logListLock);
         arrayList_destroy((*loghelper)->logServices);

http://git-wip-us.apache.org/repos/asf/celix/blob/23140b46/shell/private/src/activator.c
----------------------------------------------------------------------
diff --git a/shell/private/src/activator.c b/shell/private/src/activator.c
index 7cb2946..aed0d9b 100644
--- a/shell/private/src/activator.c
+++ b/shell/private/src/activator.c
@@ -275,6 +275,8 @@ celix_status_t bundleActivator_destroy(void *_ptr, bundle_context_pt __attribute
 
     shell_destroy(&instance_ptr->shellService);
 
+    free(instance_ptr->listener);
+
     free(instance_ptr);
 
 	return CELIX_SUCCESS;

http://git-wip-us.apache.org/repos/asf/celix/blob/23140b46/shell/private/src/shell.c
----------------------------------------------------------------------
diff --git a/shell/private/src/shell.c b/shell/private/src/shell.c
index d4fe9cc..53a2439 100644
--- a/shell/private/src/shell.c
+++ b/shell/private/src/shell.c
@@ -94,6 +94,9 @@ celix_status_t shell_destroy(shell_service_pt *shell_service_ptr) {
 			if ((*shell_service_ptr)->shell->command_reference_map_ptr) {
 				hashMap_destroy((*shell_service_ptr)->shell->command_reference_map_ptr, false,
false);
 			}
+			if ((*shell_service_ptr)->shell->logHelper) {
+				logHelper_destroy(&((*shell_service_ptr)->shell->logHelper));
+			}
 			free((*shell_service_ptr)->shell);
 			(*shell_service_ptr)->shell = NULL;
 		}


Mime
View raw message