1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-30 00:14:26 +00:00

Duplicate the name string always in api_add_data_full to not need persistent storage for names passed to it.

This commit is contained in:
Con Kolivas 2013-05-02 17:26:59 +10:00
parent d08bdfd69f
commit 965129b5b7

3
api.c
View File

@ -827,7 +827,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->name = name;
api_data->name = strdup(name);
api_data->type = type;
if (root == NULL) {
@ -1116,6 +1116,7 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
buf = strchr(buf, '\0');
free(root->name);
if (root->data_was_malloc)
free(root->data);