--- src/pulsecore/card.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c index bc5b75b..896e959 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c @@ -122,7 +122,6 @@ void pa_card_new_data_done(pa_card_new_data *data) { pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { pa_card *c; - const char *name; void *state; pa_card_profile *profile; pa_device_port *port; @@ -135,16 +134,15 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { c = pa_xnew0(pa_card, 1); - if (!(name = pa_namereg_register(core, data->name, PA_NAMEREG_CARD, c, data->namereg_fail))) { + if (!(c->name = pa_xstrdup(pa_namereg_register(core, data->name, PA_NAMEREG_CARD, c, data->namereg_fail)))) { pa_xfree(c); return NULL; } - pa_card_new_data_set_name(data, name); + pa_card_new_data_set_name(data, c->name); pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_NEW], data); c->core = core; - c->name = pa_xstrdup(data->name); c->proplist = pa_proplist_copy(data->proplist); c->driver = pa_xstrdup(pa_path_get_filename(data->driver)); c->module = data->module; -- 2.8.1