]> code.delx.au - pulseaudio/commitdiff
card-restore: Fix a memory leak
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Wed, 29 Jan 2014 18:54:39 +0000 (20:54 +0200)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Wed, 29 Jan 2014 18:56:42 +0000 (20:56 +0200)
entry_read() may set entry->profile, so we need to free that string
before we can replace it with a new string.

src/modules/module-card-restore.c

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