CELIX-335: Fix memory issue in framework when loading bundle libraries. Only occurs on ubuntu systems
Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/fc588a5a Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/fc588a5a Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/fc588a5a Branch: refs/heads/develop Commit: fc588a5acc3bee3e8b8317276383a7e0484a26c7 Parents: 632252c Author: Pepijn Noltes <[email protected]> Authored: Tue Jan 19 17:31:30 2016 +0100 Committer: Pepijn Noltes <[email protected]> Committed: Tue Jan 19 17:31:30 2016 +0100 ---------------------------------------------------------------------- cmake/cmake_celix/Packaging.cmake | 8 +++++--- framework/private/src/framework.c | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/fc588a5a/cmake/cmake_celix/Packaging.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/Packaging.cmake b/cmake/cmake_celix/Packaging.cmake index 022f5a2..16e63d0 100644 --- a/cmake/cmake_celix/Packaging.cmake +++ b/cmake/cmake_celix/Packaging.cmake @@ -15,12 +15,12 @@ # specific language governing permissions and limitations # under the License. -find_program(JAR_COMMAND jar) #TODO enable +find_program(JAR_COMMAND jar) if(JAR_COMMAND) message(STATUS "Using jar to create bundles") else() - find_program(ZIP_COMMAND zip) #TODO enable + find_program(ZIP_COMMAND zip) if(ZIP_COMMAND) message(STATUS "Using zip to create bundles") else() @@ -452,8 +452,10 @@ function(add_deploy) ##### Setting defaults ##### if(DEPLOY_GROUP) set(DEPLOY_LOCATION "${CMAKE_BINARY_DIR}/deploy/${DEPLOY_GROUP}/${DEPLOY_NAME}") + set(DEPLOY_PRINT_NAME "${DEPLOY_GROUP}/${DEPLOY_NAME}") else() set(DEPLOY_LOCATION "${CMAKE_BINARY_DIR}/deploy/${DEPLOY_NAME}") + set(DEPLOY_PRINT_NAME "${DEPLOY_NAME}") endif() ###### @@ -468,7 +470,7 @@ function(add_deploy) COMMAND ${CMAKE_COMMAND} -E touch ${DEPLOY_LOCATION}/timestamp DEPENDS "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" "${DEPLOY_LOCATION}/config.properties" "${DEPLOY_LOCATION}/run.sh" WORKING_DIRECTORY "${DEPLOY_LOCATION}" - COMMENT "Deploying ${DEPLOY_NAME}" VERBATIM + COMMENT "Deploying ${DEPLOY_PRINT_NAME}" VERBATIM ) http://git-wip-us.apache.org/repos/asf/celix/blob/fc588a5a/framework/private/src/framework.c ---------------------------------------------------------------------- diff --git a/framework/private/src/framework.c b/framework/private/src/framework.c index 2748c90..691bb40 100644 --- a/framework/private/src/framework.c +++ b/framework/private/src/framework.c @@ -2470,11 +2470,12 @@ static celix_status_t framework_loadLibraries(framework_pt framework, char *libr char *token = strtok_r(libraries, ",", &last); while (token != NULL) { void *handle = NULL; - char lib[strlen(token)]; + char lib[128]; + lib[127] = '\0'; char *path; char *pathToken = strtok_r(token, ";", &path); - strcpy(lib, pathToken); + strncpy(lib, pathToken, 127); pathToken = strtok_r(NULL, ";", &path); while (pathToken != NULL) {
