Clean up many strdups
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static struct ucl_object *ucl_object_alloc();
|
||||
|
||||
@@ -28,7 +28,7 @@ struct ucl_object *ucl_symbol_create(const char *symbol)
|
||||
{
|
||||
struct ucl_object* obj = ucl_object_alloc();
|
||||
obj->type = UCL_TYPE_SYMBOL;
|
||||
obj->symbol = symbol;
|
||||
obj->symbol = strdup(symbol);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ struct ucl_object *ucl_string_create(const char *string)
|
||||
{
|
||||
struct ucl_object* obj = ucl_object_alloc();
|
||||
obj->type = UCL_TYPE_STRING;
|
||||
obj->string = string;
|
||||
obj->string = strdup(string);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ struct ucl_object *ucl_error_create(const char *error)
|
||||
{
|
||||
struct ucl_object* obj = ucl_object_alloc();
|
||||
obj->type = UCL_TYPE_ERROR;
|
||||
obj->error = error;
|
||||
obj->error = strdup(error);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user