rescue-streams: Fix segfault in some conditions
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 2 Dec 2010 11:00:59 +0000 (16:30 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 2 Dec 2010 11:00:59 +0000 (16:30 +0530)
There is a call to this function where 'skip' variable is NULL. Looks
like this code doesn't get hit very often, probably because a suitable
default sink can be found to move the stream to. However, if we can't
move to the default sink and skip is NULL, there will be a segfault.

src/modules/module-rescue-streams.c

index 722d84b29ac9d247401c56c9e823a9fb16c7f8e4..2fcd21f063a9725e65635903e12c6d621eb7b556 100644 (file)
@@ -159,7 +159,7 @@ static pa_source* find_evacuation_source(pa_core *c, pa_source_output *o, pa_sou
         if (target == skip)
             continue;
 
-        if (!target->monitor_of != !skip->monitor_of)
+        if (skip && !target->monitor_of != !skip->monitor_of)
             continue;
 
         if (!PA_SOURCE_IS_LINKED(pa_source_get_state(target)))