From 9695e75fbd7c0b969d581f91bc468f53bfda9a7e Mon Sep 17 00:00:00 2001 From: "punyabrata@google.com" Date: Mon, 22 Aug 2011 22:35:14 +0000 Subject: [PATCH] Resolve a crash related to pulseAudio where we need to check if pa_context_get_source_info_by_name/pa_context_get_sink_info_by_name has early failure and returns NULL,then to avoid WaitForOperationCompletion from crashing, paOperation must be checked to ensure it is not NULL. Please note that ::WaitForOperationCompletion( ) is a void function therefore returning without any error code if paOperation is indeed NULL Google internal bug id [4356730] Review URL: http://webrtc-codereview.appspot.com/122003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@417 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../main/source/linux/audio_device_pulse_linux.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/audio_device/main/source/linux/audio_device_pulse_linux.cc b/src/modules/audio_device/main/source/linux/audio_device_pulse_linux.cc index 231b186a96..bbb86ee5ad 100644 --- a/src/modules/audio_device/main/source/linux/audio_device_pulse_linux.cc +++ b/src/modules/audio_device/main/source/linux/audio_device_pulse_linux.cc @@ -2509,6 +2509,13 @@ void AudioDeviceLinuxPulse::PaUnLock() void AudioDeviceLinuxPulse::WaitForOperationCompletion( pa_operation* paOperation) const { + if (!paOperation) + { + WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, + "paOperation NULL in WaitForOperationCompletion"); + return; + } + while (LATE(pa_operation_get_state)(paOperation) == PA_OPERATION_RUNNING) { LATE(pa_threaded_mainloop_wait)(_paMainloop);