cli: copy name

This commit is contained in:
Wim Taymans 2019-01-10 13:16:11 +01:00
parent 1cb8a61b71
commit 01e28dd7a8

View file

@ -67,7 +67,7 @@ struct remote_data {
struct spa_list link; struct spa_list link;
struct data *data; struct data *data;
const char *name; char *name;
uint32_t id; uint32_t id;
struct pw_remote *remote; struct pw_remote *remote;
@ -242,7 +242,8 @@ static bool do_load_module(struct data *data, const char *cmd, char *args, char
static void on_core_info(void *_data, const struct pw_core_info *info) static void on_core_info(void *_data, const struct pw_core_info *info)
{ {
struct remote_data *rd = _data; struct remote_data *rd = _data;
rd->name = info->name; free(rd->name);
rd->name = strdup(info->name);
fprintf(stdout, "remote %d is named '%s'\n", rd->id, rd->name); fprintf(stdout, "remote %d is named '%s'\n", rd->id, rd->name);
} }
@ -355,6 +356,7 @@ static void on_remote_destroy(void *_data)
if (data->current == rd) if (data->current == rd)
data->current = NULL; data->current = NULL;
free(rd->name);
} }
static const struct pw_core_proxy_events remote_core_events = { static const struct pw_core_proxy_events remote_core_events = {