[PATCH] sink-input, source-output: fix unitialized variable access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The volume_map variable is initialized only for PCM streams, but the
variable was passed to pa_cvolume_remap() also for non-PCM streams. The
volume remapping is never necessary for non-PCM streams, because no
volume will be applied anyway, so let's just skip the pa_cvolume_remap()
call.
---
 src/pulsecore/sink-input.c    | 2 +-
 src/pulsecore/source-output.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 4155b69a5..936414b93 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -396,7 +396,7 @@ int pa_sink_input_new(
     if (!data->volume_writable)
         data->save_volume = false;
 
-    if (data->volume_is_set)
+    if (data->volume_is_set && pa_format_info_is_pcm(data->format))
         /* The original volume channel map may be different than the final
          * stream channel map, so remapping may be needed. */
         pa_cvolume_remap(&data->volume, &volume_map, &data->channel_map);
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index a4c99af0e..c66599224 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -332,7 +332,7 @@ int pa_source_output_new(
     if (!data->volume_writable)
         data->save_volume = false;
 
-    if (data->volume_is_set)
+    if (data->volume_is_set && pa_format_info_is_pcm(data->format))
         /* The original volume channel map may be different than the final
          * stream channel map, so remapping may be needed. */
         pa_cvolume_remap(&data->volume, &volume_map, &data->channel_map);
-- 
2.14.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux