summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimjeongYeon <see2002@gmail.com>2017-04-13 20:33:26 +0200
committerGeorg Chini <georg@chini.tk>2017-04-13 20:41:20 +0200
commit1f0c4f7d6af250e1d8dbb020de0f83afcec858b0 (patch)
tree96f88bb77bd43b10a10c4e74de7d85546a9e46d4
parentab7d01a983d080f09309c98ecd8c43cebd1ca2b2 (diff)
filter-apply: Fix memory leak in process()
fltr->name should be freed before freeing fltr. Because filter_free() can never be called from other places without f set, the pa_assert() can be removed and filter_free() can be used in process() as well.
-rw-r--r--src/modules/module-filter-apply.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c
index 364d68be..193b2ce2 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;
}