Browse Source

Merge commit '965129b' into cg_merges_20130524b

Conflicts:
	api.c
Luke Dashjr 12 years ago
parent
commit
5720a863e9
1 changed files with 2 additions and 1 deletions
  1. 2 1
      api.c

+ 2 - 1
api.c

@@ -836,7 +836,7 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
 
 
 	api_data = (struct api_data *)malloc(sizeof(struct api_data));
 	api_data = (struct api_data *)malloc(sizeof(struct api_data));
 
 
-	api_data->name = name;
+	api_data->name = strdup(name);
 	api_data->type = type;
 	api_data->type = type;
 
 
 	if (root == NULL) {
 	if (root == NULL) {
@@ -1143,6 +1143,7 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
 
 
 		buf = strchr(buf, '\0');
 		buf = strchr(buf, '\0');
 
 
+		free(root->name);
 		if (root->type == API_JSON)
 		if (root->type == API_JSON)
 			json_decref((json_t *)root->data);
 			json_decref((json_t *)root->data);
 		if (root->data_was_malloc)
 		if (root->data_was_malloc)