[pulseaudio-discuss] [PATCH] echo-cancel: fix another segfault during sink-input move

Georg Chini georg at chini.tk
Mon Apr 24 15:31:52 UTC 2017


When a sink input is moved away from the echo cancel sink while the master sink of
module-echo-cancel is invalid, pa_sink_input_set_requested_latency_within_thread()
called from sink_update_requested_latency_cb() would segfault due to the invalid
sink. The same applies for the source side.

This patch checks the validity of the master sink or source in *_update_requested_latency_cb()
and simply returns if the sink or source is invalid.
---
 src/modules/echo-cancel/module-echo-cancel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 7e7290e6..f7856daf 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -525,7 +525,8 @@ static void source_update_requested_latency_cb(pa_source *s) {
     pa_assert_se(u = s->userdata);
 
     if (!PA_SOURCE_IS_LINKED(u->source->thread_info.state) ||
-        !PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->thread_info.state))
+        !PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->thread_info.state) ||
+        !u->source_output->source)
         return;
 
     pa_log_debug("Source update requested latency");
@@ -546,7 +547,8 @@ static void sink_update_requested_latency_cb(pa_sink *s) {
     pa_assert_se(u = s->userdata);
 
     if (!PA_SINK_IS_LINKED(u->sink->thread_info.state) ||
-        !PA_SINK_INPUT_IS_LINKED(u->sink_input->thread_info.state))
+        !PA_SINK_INPUT_IS_LINKED(u->sink_input->thread_info.state) ||
+        !u->sink_input->sink)
         return;
 
     pa_log_debug("Sink update requested latency");
-- 
2.11.0



More information about the pulseaudio-discuss mailing list