celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1602070 - in /incubator/celix/trunk/framework: private/include/ private/mock/ private/src/ public/include/
Date Thu, 12 Jun 2014 06:27:46 GMT
Author: abroekhuis
Date: Thu Jun 12 06:27:45 2014
New Revision: 1602070

URL: http://svn.apache.org/r1602070
Log:
CELIX-119: Fixed memory leaks

Modified:
    incubator/celix/trunk/framework/private/include/manifest_parser.h
    incubator/celix/trunk/framework/private/mock/manifest_parser_mock.c
    incubator/celix/trunk/framework/private/src/bundle_archive.c
    incubator/celix/trunk/framework/private/src/bundle_revision.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/manifest_parser.c
    incubator/celix/trunk/framework/private/src/module.c
    incubator/celix/trunk/framework/public/include/bundle_revision.h

Modified: incubator/celix/trunk/framework/private/include/manifest_parser.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/manifest_parser.h?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/manifest_parser.h (original)
+++ incubator/celix/trunk/framework/private/include/manifest_parser.h Thu Jun 12 06:27:45
2014
@@ -35,6 +35,7 @@
 typedef struct manifestParser * manifest_parser_pt;
 
 celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, manifest_parser_pt
*manifest_parser);
+celix_status_t manifestParser_destroy(manifest_parser_pt mp);
 
 celix_status_t manifestParser_getSymbolicName(manifest_parser_pt parser, char **symbolicName);
 celix_status_t manifestParser_getBundleVersion(manifest_parser_pt parser, version_pt *version);

Modified: incubator/celix/trunk/framework/private/mock/manifest_parser_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/manifest_parser_mock.c?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/manifest_parser_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/manifest_parser_mock.c Thu Jun 12 06:27:45
2014
@@ -28,22 +28,27 @@
 #include "manifest_parser.h"
 
 celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, manifest_parser_pt
*manifest_parser) {
-	mock_c()->actualCall("bundle_getCurrentModule");
+	mock_c()->actualCall("manifestParser_create");
 	return mock_c()->returnValue().value.intValue;
 }
 
+celix_status_t manifestParser_destroy(manifest_parser_pt manifest_parser) {
+    mock_c()->actualCall("manifestParser_destroy");
+    return mock_c()->returnValue().value.intValue;
+}
+
 celix_status_t manifestParser_getSymbolicName(manifest_parser_pt parser, char **symbolicName)
{
-	mock_c()->actualCall("bundle_getCurrentModule");
+	mock_c()->actualCall("manifestParser_getSymbolicName");
 	return mock_c()->returnValue().value.intValue;
 }
 
 celix_status_t manifestParser_getBundleVersion(manifest_parser_pt parser, version_pt *version)
{
-	mock_c()->actualCall("bundle_getCurrentModule");
+	mock_c()->actualCall("manifestParser_getBundleVersion");
 	return mock_c()->returnValue().value.intValue;
 }
 
 celix_status_t manifestParser_getCapabilities(manifest_parser_pt parser, linked_list_pt *capabilities)
{
-	mock_c()->actualCall("bundle_getCurrentModule");
+	mock_c()->actualCall("manifestParser_getCapabilities");
 	return mock_c()->returnValue().value.intValue;
 }
 

Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Thu Jun 12 06:27:45 2014
@@ -138,6 +138,12 @@ celix_status_t bundleArchive_destroy(bun
     celix_status_t status = CELIX_SUCCESS;
 
 	if (archive->revisions != NULL) {
+	    linked_list_iterator_pt iter = linkedListIterator_create(archive->revisions, 0);
+	    while(linkedListIterator_hasNext(iter)) {
+            bundle_revision_pt rev = linkedListIterator_next(iter);
+            bundleRevision_destroy(rev);
+	    }
+
 		linkedList_destroy(archive->revisions);
 	}
 	archive = NULL;

Modified: incubator/celix/trunk/framework/private/src/bundle_revision.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_revision.c?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_revision.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_revision.c Thu Jun 12 06:27:45 2014
@@ -78,7 +78,8 @@ celix_status_t bundleRevision_create(fra
 	return status;
 }
 
-celix_status_t bundleRevision_destroy(celix_status_t *revision) {
+celix_status_t bundleRevision_destroy(bundle_revision_pt revision) {
+    arrayList_destroy(revision->libraryHandles);
 	return CELIX_SUCCESS;
 }
 

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Thu Jun 12 06:27:45 2014
@@ -245,9 +245,9 @@ celix_status_t framework_destroy(framewo
 			linkedListIterator_destroy(iter);
 		}
 
-//		if (bundle_getArchive(bundle, &archive) == CELIX_SUCCESS) {
-//			bundleArchive_destroy(archive);
-//		}
+		if (bundle_getArchive(bundle, &archive) == CELIX_SUCCESS) {
+			bundleArchive_destroy(archive);
+		}
 		bundle_destroy(bundle);
 		hashMapIterator_remove(iterator);
 	}

Modified: incubator/celix/trunk/framework/private/src/manifest_parser.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest_parser.c?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest_parser.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest_parser.c Thu Jun 12 06:27:45 2014
@@ -95,6 +95,22 @@ celix_status_t manifestParser_create(mod
 	return status;
 }
 
+celix_status_t manifestParser_destroy(manifest_parser_pt mp) {
+    linkedList_destroy(mp->capabilities);
+    mp->capabilities = NULL;
+    linkedList_destroy(mp->requirements);
+    mp->requirements = NULL;
+    mp->bundleSymbolicName = NULL;
+    version_destroy(mp->bundleVersion);
+    mp->bundleVersion = NULL;
+    mp->manifest = NULL;
+    mp->owner = NULL;
+
+    free(mp);
+
+    return CELIX_SUCCESS;
+}
+
 static linked_list_pt manifestParser_parseDelimitedString(char * value, char * delim) {
     linked_list_pt list;
 
@@ -303,10 +319,13 @@ static linked_list_pt manifestParser_par
             linked_list_pt clause = linkedListIterator_next(iter);
 
             linked_list_pt paths = linkedList_get(clause, 0);
+            linkedList_destroy(paths);
 
             linkedListIterator_remove(iter);
+            linkedList_destroy(clause);
         }
         linkedListIterator_destroy(iter);
+        linkedList_destroy(clauses);
 
 	return requirements;
 }
@@ -351,10 +370,13 @@ static linked_list_pt manifestParser_par
         linked_list_pt clause = linkedListIterator_next(iter);
 
         linked_list_pt paths = linkedList_get(clause, 0);
+        linkedList_destroy(paths);
 
         linkedListIterator_remove(iter);
+        linkedList_destroy(clause);
     }
     linkedListIterator_destroy(iter);
+    linkedList_destroy(clauses);
 
 	return capabilities;
 }

Modified: incubator/celix/trunk/framework/private/src/module.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/module.c?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/module.c (original)
+++ incubator/celix/trunk/framework/private/src/module.c Thu Jun 12 06:27:45 2014
@@ -79,6 +79,8 @@ module_pt module_create(manifest_pt head
             manifestParser_getRequirements(mp, &module->requirements);
 
             module->wires = NULL;
+
+            manifestParser_destroy(mp);
         }
     }
 

Modified: incubator/celix/trunk/framework/public/include/bundle_revision.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_revision.h?rev=1602070&r1=1602069&r2=1602070&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/bundle_revision.h (original)
+++ incubator/celix/trunk/framework/public/include/bundle_revision.h Thu Jun 12 06:27:45 2014
@@ -64,6 +64,8 @@ typedef struct bundleRevision * bundle_r
  */
 celix_status_t bundleRevision_create(framework_logger_pt logger, char *root, char *location,
long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision);
 
+celix_status_t bundleRevision_destroy(bundle_revision_pt revision);
+
 /**
  * Retrieves the revision number of the given revision.
  *



Mime
View raw message