From ec4fa4c668a61de8ed7c9452e73919ba0bb1a870 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Wed, 8 Jun 2011 20:18:12 +0100 Subject: esound,streams: Fix some crashes. After the rework to the add pa_sink_input_new_data_set_sink() (and the source equiv) calling with a NULL sink object will hit an assert. This caused crashes with the esd protocol and there was the potential (albeit unlikely) for a crash when creating a sink input without any sinks available (module-always-sink mitigates this risk but it's still a potential crasher). --- src/pulsecore/protocol-esound.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/pulsecore/protocol-esound.c') diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c index edca96a1..484821c5 100644 --- a/src/pulsecore/protocol-esound.c +++ b/src/pulsecore/protocol-esound.c @@ -426,7 +426,8 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void sdata.driver = __FILE__; sdata.module = c->options->module; sdata.client = c->client; - pa_sink_input_new_data_set_sink(&sdata, sink, FALSE); + if (sink) + pa_sink_input_new_data_set_sink(&sdata, sink, FALSE); pa_sink_input_new_data_set_sample_spec(&sdata, &ss); pa_sink_input_new(&c->sink_input, c->protocol->core, &sdata); @@ -524,7 +525,8 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi sdata.driver = __FILE__; sdata.module = c->options->module; sdata.client = c->client; - pa_source_output_new_data_set_source(&sdata, source, FALSE); + if (source) + pa_source_output_new_data_set_source(&sdata, source, FALSE); pa_source_output_new_data_set_sample_spec(&sdata, &ss); pa_source_output_new(&c->source_output, c->protocol->core, &sdata); -- cgit