From ef7740be67a4d7b6b033ebed59c3d4a9c74a2c18 Mon Sep 17 00:00:00 2001 From: John Grossman Date: Thu, 9 Feb 2012 11:28:36 -0800 Subject: [PATCH] Fix a segfault in AudioFlinger. Check the string returned by a HAL's implementation of get_parameters for NULL before attempting to make use of it. That way, we won't bring down the mediaserver because of a poorly written HAL. Change-Id: Ic99d7b004520d7d6347842a681c0595e889b68ea Signed-off-by: John Grossman --- services/audioflinger/AudioFlinger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 31567c2d22..29d63de1bf 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -906,7 +906,7 @@ String8 AudioFlinger::getParameters(audio_io_handle_t ioHandle, const String8& k for (size_t i = 0; i < mAudioHwDevs.size(); i++) { audio_hw_device_t *dev = mAudioHwDevs[i]; char *s = dev->get_parameters(dev, keys.string()); - out_s8 += String8(s); + out_s8 += String8(s ? s : ""); free(s); } return out_s8; -- 2.11.0