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-324: adapt version.c to work on string copy to prevent messing up the original string
Date Mon, 14 Dec 2015 17:18:34 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 4e271f08f -> 20b89946d


CELIX-324: adapt version.c to work on string copy to prevent messing up the original string


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

Branch: refs/heads/develop
Commit: 20b89946d921f98b0f50bb85891abb729b03ce03
Parents: 4e271f0
Author: Bjoern Petri <bpetri@apache.org>
Authored: Mon Dec 14 18:17:29 2015 +0100
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Mon Dec 14 18:17:29 2015 +0100

----------------------------------------------------------------------
 utils/private/src/version.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/20b89946/utils/private/src/version.c
----------------------------------------------------------------------
diff --git a/utils/private/src/version.c b/utils/private/src/version.c
index 3f8ddfa..4010953 100644
--- a/utils/private/src/version.c
+++ b/utils/private/src/version.c
@@ -111,7 +111,9 @@ celix_status_t version_createVersionFromString(char * versionStr, version_pt
*ve
 
 	int i = 0;
 
-	token = strtok_r(versionStr, delims, &last);
+	char* versionWrkStr = strdup(versionStr);
+
+	token = strtok_r(versionWrkStr, delims, &last);
 	if (token != NULL) {
 		for (i = 0; i < strlen(token); i++) {
 			char ch = token[i];
@@ -156,6 +158,9 @@ celix_status_t version_createVersionFromString(char * versionStr, version_pt
*ve
 			}
 		}
 	}
+
+	free(versionWrkStr);
+
 	if (status == CELIX_SUCCESS) {
 		status = version_createVersion(major, minor, micro, qualifier, version);
 	}


Mime
View raw message