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).
This commit is contained in:
Colin Guthrie 2011-06-08 20:18:12 +01:00
parent 32927c50a8
commit ec4fa4c668
3 changed files with 14 additions and 9 deletions

View file

@ -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);