[pulseaudio-commits] src/modules
Arun Raghavan
arun at kemper.freedesktop.org
Wed Oct 9 11:49:23 PDT 2013
src/modules/alsa/alsa-sink.c | 18 ++++++++++--------
src/modules/alsa/alsa-source.c | 18 ++++++++++--------
2 files changed, 20 insertions(+), 16 deletions(-)
New commits:
commit f81e3e1d7852c05b4b737ac7dac4db95798f0117
Author: Jan Alexander Steffens (heftig) <jan.steffens at gmail.com>
Date: Wed Oct 9 20:29:39 2013 +0200
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.
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index d3d5b19..e10e14e 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2032,14 +2032,16 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
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 */
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 8416ba8..2e93e0f 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -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 */
More information about the pulseaudio-commits
mailing list