card-restore: Fix a memory leak

entry_read() may set entry->profile, so we need to free that string
before we can replace it with a new string.
This commit is contained in:
Tanu Kaskinen 2014-01-29 20:54:39 +02:00
parent 537f430c99
commit c95b4c22ca

View file

@ -390,6 +390,7 @@ static pa_hook_result_t card_profile_changed_callback(pa_core *c, pa_card *card,
return PA_HOOK_OK; return PA_HOOK_OK;
if ((entry = entry_read(u, card->name))) { if ((entry = entry_read(u, card->name))) {
pa_xfree(entry->profile);
entry->profile = pa_xstrdup(card->active_profile->name); entry->profile = pa_xstrdup(card->active_profile->name);
pa_log_info("Storing card profile for card %s.", card->name); pa_log_info("Storing card profile for card %s.", card->name);
} else { } else {