celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1640681 - /celix/trunk/deployment_admin/private/src/deployment_admin.c
Date Thu, 20 Nov 2014 05:39:31 GMT
Author: bpetri
Date: Thu Nov 20 05:39:31 2014
New Revision: 1640681

URL: http://svn.apache.org/r1640681
Log:
CELIX-186: Fixed segfault in deployment admin

Modified:
    celix/trunk/deployment_admin/private/src/deployment_admin.c

Modified: celix/trunk/deployment_admin/private/src/deployment_admin.c
URL: http://svn.apache.org/viewvc/celix/trunk/deployment_admin/private/src/deployment_admin.c?rev=1640681&r1=1640680&r2=1640681&view=diff
==============================================================================
--- celix/trunk/deployment_admin/private/src/deployment_admin.c (original)
+++ celix/trunk/deployment_admin/private/src/deployment_admin.c Thu Nov 20 05:39:31 2014
@@ -190,10 +190,8 @@ static void * APR_THREAD_FUNC deployment
 					request = apr_pstrcat(admin->pool, admin->pollUrl, "/", last, NULL);
 				}
 
-				char inputFile[256];
-				inputFile[0] = '\0';
-				char *test = inputFile;
-				celix_status_t status = deploymentAdmin_download(request, &test);
+				char *inputFilename = NULL;
+				celix_status_t status = deploymentAdmin_download(request, &inputFilename);
 				if (status == CELIX_SUCCESS) {
 					bundle_pt bundle = NULL;
 					bundleContext_getBundle(admin->context, &bundle);
@@ -210,7 +208,7 @@ static void * APR_THREAD_FUNC deployment
 					apr_dir_make(tmpDir, APR_UREAD|APR_UWRITE|APR_UEXECUTE, admin->pool);
 
 					// TODO: update to use bundle cache DataFile instead of module entries.
-					unzip_extractDeploymentPackage(test, tmpDir);
+					unzip_extractDeploymentPackage(inputFilename, tmpDir);
 					char *manifest = apr_pstrcat(admin->pool, tmpDir, "/META-INF/MANIFEST.MF", NULL);
 					manifest_pt mf = NULL;
 					manifest_createFromFile(manifest, &mf);
@@ -243,10 +241,13 @@ static void * APR_THREAD_FUNC deployment
 
 					deploymentAdmin_deleteTree(repoCache, admin->pool);
 					deploymentAdmin_deleteTree(tmpDir, admin->pool);
-					remove(test);
+					remove(inputFilename);
 					admin->current = strdup(last);
 					hashMap_put(admin->packages, name, source);
 				}
+				if (inputFilename != NULL) {
+					free(inputFilename);
+				}
 			}
 		}
 		sleep(5);
@@ -320,7 +321,7 @@ celix_status_t deploymentAdmin_download(
 	CURLcode res = 0;
 	curl = curl_easy_init();
 	if (curl) {
-	    *inputFile = "updateXXXXXX";
+	    *inputFile = strdup("updateXXXXXX");
         int fd = mkstemp(*inputFile);
         if (fd) {
             FILE *fp = fopen(*inputFile, "wb+");



Mime
View raw message