alsa: Fix crash when loading bare ALSA sink/source

module-alsa-{sink,source}.c call pa_alsa_{sink,source}_new with
mapping set to NULL. Guard against this, like the rest of the
function does.

module-alsa-card does not use NULL, so this went unnoticed so far.
This commit is contained in:
Jan Alexander Steffens (heftig) 2013-10-09 20:29:39 +02:00 committed by Arun Raghavan
parent 35fea579cb
commit f81e3e1d78
2 changed files with 20 additions and 16 deletions

View file

@ -1742,14 +1742,16 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
map = m->core->default_channel_map;
/* Pick sample spec overrides from the mapping, if any */
if (mapping->sample_spec.format != PA_SAMPLE_INVALID)
ss.format = mapping->sample_spec.format;
if (mapping->sample_spec.rate != 0)
ss.rate = mapping->sample_spec.rate;
if (mapping->sample_spec.channels != 0) {
ss.channels = mapping->sample_spec.channels;
if (pa_channel_map_valid(&mapping->channel_map))
pa_assert(pa_channel_map_compatible(&mapping->channel_map, &ss));
if (mapping) {
if (mapping->sample_spec.format != PA_SAMPLE_INVALID)
ss.format = mapping->sample_spec.format;
if (mapping->sample_spec.rate != 0)
ss.rate = mapping->sample_spec.rate;
if (mapping->sample_spec.channels != 0) {
ss.channels = mapping->sample_spec.channels;
if (pa_channel_map_valid(&mapping->channel_map))
pa_assert(pa_channel_map_compatible(&mapping->channel_map, &ss));
}
}
/* Override with modargs if provided */