You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2024/01/22 18:56:48 UTC
(celix) 03/03: Fix memleak in properties setStrings and setVersions
This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/674-improve-properties
in repository https://gitbox.apache.org/repos/asf/celix.git
commit e2373dfa0cd023ef9e6a9828339fc78eb716a0f9
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Mon Jan 22 19:56:37 2024 +0100
Fix memleak in properties setStrings and setVersions
---
libs/utils/src/properties.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libs/utils/src/properties.c b/libs/utils/src/properties.c
index 1fd9753e..b478bf7d 100644
--- a/libs/utils/src/properties.c
+++ b/libs/utils/src/properties.c
@@ -1223,6 +1223,7 @@ celix_properties_setStrings(celix_properties_t* properties, const char* key, con
celix_status_t status = celix_arrayList_addString(list, copy);
if (status != CELIX_SUCCESS) {
celix_err_push("Failed to add string to array list");
+ free(copy);
return status;
}
}
@@ -1354,6 +1355,7 @@ celix_properties_setVersions(celix_properties_t* properties, const char* key, co
celix_status_t status = celix_arrayList_add(list, copy);
if (status != CELIX_SUCCESS) {
celix_err_push("Failed to add version to array list");
+ celix_version_destroy(copy);
return status;
}
}