From e67bf20a9d9df7f8835881711439c4319fbf2d24 Mon Sep 17 00:00:00 2001 From: Nitin Srivastava Date: Fri, 31 Jan 2014 15:51:24 +0530 Subject: [PATCH] Set out stream to null if control socket fails to connect Set out stream to null if control socket fails to connect. This helps in avoiding wrong usage of audio device out stream even after the same is freed as part of control socket connection failure. Change-Id: I8e2a7bbc71d581525b7eef1955e411c220d01627 --- audio_a2dp_hw/audio_a2dp_hw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c index 10432f1a6..e53ad5d71 100644 --- a/audio_a2dp_hw/audio_a2dp_hw.c +++ b/audio_a2dp_hw/audio_a2dp_hw.c @@ -942,6 +942,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev, err_open: free(out); *stream_out = NULL; + a2dp_dev->output = NULL; ERROR("failed"); return ret; } @@ -971,8 +972,10 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) int retval = 0; if (out == NULL) + { + ERROR("ERROR: set param called even when stream out is null"); return retval; - + } INFO("state %d", out->state); retval = out->stream.common.set_parameters((struct audio_stream *)out, kvpairs); -- 2.11.0