Clean up many strdups

This commit is contained in:
2022-11-02 20:36:07 -04:00
parent 9c1a81811c
commit 3b7bef779b
11 changed files with 39 additions and 31 deletions

View File

@@ -34,7 +34,7 @@ struct ucl_object *ucl_state_get(struct ucl_state *state, const char *name) {
struct ucl_object *cell = ucl_state_get_cell(state, name);
if (cell == NULL) {
if (state->parent == NULL) {
return ucl_error_create(strdup("Unknown error"));
return ucl_error_create("Unknown error");
} else {
return ucl_state_get(state->parent, name);
}
@@ -47,7 +47,7 @@ void ucl_state_put(struct ucl_state *state, const char *name, struct ucl_object
if (cell == NULL) {
ucl_list_append(state->list,
ucl_tuple_create(
ucl_string_create(strdup(name)),
ucl_string_create(name),
obj));
} else {
// TODO: Refcounting / cleanup