diff options
author | Colin Guthrie <colin@mageia.org> | 2011-06-08 20:18:12 +0100 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2011-06-22 22:45:28 +0100 |
commit | ec4fa4c668a61de8ed7c9452e73919ba0bb1a870 (patch) | |
tree | 2cd3643615f5124322efa2b79a08d9c94c951cbc /src/pulsecore/source-output.c | |
parent | 32927c50a8fef49f8a24eee82bf4ca64253a3dfc (diff) |
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).
Diffstat (limited to 'src/pulsecore/source-output.c')
-rw-r--r-- | src/pulsecore/source-output.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index e6cec605..59b6c2ff 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -253,8 +253,11 @@ int pa_source_output_new( pa_return_val_if_fail(!data->driver || pa_utf8_valid(data->driver), -PA_ERR_INVALID); - if (!data->source) - pa_source_output_new_data_set_source(data, pa_namereg_get(core, NULL, PA_NAMEREG_SOURCE), FALSE); + if (!data->source) { + pa_source *source = pa_namereg_get(core, NULL, PA_NAMEREG_SOURCE); + pa_return_val_if_fail(source, -PA_ERR_NOENTITY); + pa_source_output_new_data_set_source(data, source, FALSE); + } /* Routing's done, we have a source. Now let's fix the format and set up the * sample spec */ @@ -278,7 +281,6 @@ int pa_source_output_new( pa_source_output_new_data_set_sample_spec(data, &ss); } - pa_return_val_if_fail(data->source, -PA_ERR_NOENTITY); pa_return_val_if_fail(PA_SOURCE_IS_LINKED(pa_source_get_state(data->source)), -PA_ERR_BADSTATE); pa_return_val_if_fail(!data->direct_on_input || data->direct_on_input->sink == data->source->monitor_of, -PA_ERR_INVALID); |