OSDN Git Service

Set out stream to null if control socket fails to connect
authorNitin Srivastava <nitinsr@codeaurora.org>
Fri, 31 Jan 2014 10:21:24 +0000 (15:51 +0530)
committerMatthew Xie <mattx@google.com>
Tue, 6 May 2014 08:14:24 +0000 (01:14 -0700)
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

index 10432f1..e53ad5d 100644 (file)
@@ -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);