summaryrefslogtreecommitdiffstats
path: root/src/util/profile/prof_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/profile/prof_get.c')
-rw-r--r--src/util/profile/prof_get.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c
index c79500215f..6426e15b96 100644
--- a/src/util/profile/prof_get.c
+++ b/src/util/profile/prof_get.c
@@ -85,10 +85,9 @@ static errcode_t add_to_list(struct profile_string_list *list, const char *str)
list->max = newmax;
list->list = newlist;
}
- newstr = malloc(strlen(str)+1);
+ newstr = strdup(str);
if (newstr == 0)
return ENOMEM;
- strcpy(newstr, str);
list->list[list->num++] = newstr;
list->list[list->num] = 0;
@@ -217,10 +216,9 @@ profile_get_string(profile_t profile, const char *name, const char *subname,
value = def_val;
if (value) {
- *ret_string = malloc(strlen(value)+1);
+ *ret_string = strdup(value);
if (*ret_string == 0)
return ENOMEM;
- strcpy(*ret_string, value);
} else
*ret_string = 0;
return 0;