[pulseaudio-discuss] [PATCH v2] filter-apply: Fixed memory leak.

KimJeongYeon see2002 at gmail.com
Thu Apr 13 13:35:53 UTC 2017


'fltr->name' should free prior to free 'fltr'. Instead, use filter_free().

Signed-off-by: KimJeongYeon <jeongyeon.kim at samsung.com>
---
 src/modules/module-filter-apply.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c
index 364d68b..193b2ce 100644
--- a/src/modules/module-filter-apply.c
+++ b/src/modules/module-filter-apply.c
@@ -114,10 +114,10 @@ static struct filter *filter_new(const char *name, pa_sink *sink, pa_source *sou
 }
 
 static void filter_free(struct filter *f) {
-    pa_assert(f);
-
-    pa_xfree(f->name);
-    pa_xfree(f);
+    if (f) {
+        pa_xfree(f->name);
+        pa_xfree(f);
+    }
 }
 
 static const char* should_filter(pa_object *o, bool is_sink_input) {
@@ -506,7 +506,7 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_i
 
 done:
     pa_xfree(module_name);
-    pa_xfree(fltr);
+    filter_free(fltr);
 
     return PA_HOOK_OK;
 }
-- 
2.7.4



More information about the pulseaudio-discuss mailing list