[pulseaudio-discuss] [PATCH v2 05/12] modules: Fix entry leak in module-card-restore

Peter Meerwald pmeerw at pmeerw.net
Tue Sep 15 15:01:43 PDT 2015


From: Peter Meerwald <p.meerwald at bct-electronic.com>

CID 1323585

entry_read() allocates an entry which must be freed
---
 src/modules/module-card-restore.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c
index eb6c94a..19069c2 100644
--- a/src/modules/module-card-restore.c
+++ b/src/modules/module-card-restore.c
@@ -438,13 +438,16 @@ static pa_hook_result_t profile_available_changed_callback(void *hook_data, void
     if (!entry)
         return PA_HOOK_OK;
 
-    if (!pa_streq(profile->name, entry->profile))
+    if (!pa_streq(profile->name, entry->profile)) {
+        entry_free(entry);
         return PA_HOOK_OK;
+    }
 
     pa_log_info("Card %s profile %s became available, activating.", card->name, profile->name);
     if (pa_card_set_profile(profile->card, profile, true) != 0)
         pa_log_warn("Could not set profile '%s'", profile->name);
 
+    entry_free(entry);
     return PA_HOOK_OK;
 }
 
-- 
1.9.1



More information about the pulseaudio-discuss mailing list