celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1646632 - in /celix/trunk/framework/private/src: bundle_revision.c framework.c
Date Fri, 19 Dec 2014 06:46:28 GMT
Author: bpetri
Date: Fri Dec 19 06:46:28 2014
New Revision: 1646632

URL: http://svn.apache.org/r1646632
Log:
fixed some leaks in case the bundle installation fails.

Modified:
    celix/trunk/framework/private/src/bundle_revision.c
    celix/trunk/framework/private/src/framework.c

Modified: celix/trunk/framework/private/src/bundle_revision.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/bundle_revision.c?rev=1646632&r1=1646631&r2=1646632&view=diff
==============================================================================
--- celix/trunk/framework/private/src/bundle_revision.c (original)
+++ celix/trunk/framework/private/src/bundle_revision.c Fri Dec 19 06:46:28 2014
@@ -45,6 +45,7 @@ celix_status_t bundleRevision_create(fra
     	// TODO: This overwrites an existing revision, is this supposed to happen?
         int state = mkdir(root, S_IRWXU);
         if ((state != 0) && (errno != EEXIST)) {
+            free(revision);
             status = CELIX_FILE_IO_EXCEPTION;
         } else {
             if (inputFile != NULL) {
@@ -68,6 +69,10 @@ celix_status_t bundleRevision_create(fra
                 snprintf(manifest, sizeof(manifest), "%s/META-INF/MANIFEST.MF", revision->root);
 				status = manifest_createFromFile(manifest, &revision->manifest);
             }
+            else {
+            	free(revision);
+            }
+
         }
     }
 

Modified: celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/framework.c?rev=1646632&r1=1646631&r2=1646632&view=diff
==============================================================================
--- celix/trunk/framework/private/src/framework.c (original)
+++ celix/trunk/framework/private/src/framework.c Fri Dec 19 06:46:28 2014
@@ -528,6 +528,10 @@ celix_status_t fw_installBundle2(framewo
             id = framework_getNextBundleId(framework);
 
             status = CELIX_DO_IF(status, bundleCache_createArchive(framework->cache, id,
location, inputFile, &archive));
+
+            if (status != CELIX_SUCCESS) {
+            	bundleArchive_destroy(archive);
+            }
         } else {
             // purge revision
             // multiple revisions not yet implemented



Mime
View raw message