From 4f781c78de26420a9617431ce75008de6b73fbc5 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 18 Jul 2014 12:48:05 +0300 Subject: [PATCH] android/hal-sco: Check file descriptor >= 0 --- android/hal-sco.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/hal-sco.c b/android/hal-sco.c index 905d6fcb2..bcaa8201b 100644 --- a/android/hal-sco.c +++ b/android/hal-sco.c @@ -715,11 +715,11 @@ static void sco_close_output_stream(struct audio_hw_device *dev, struct sco_dev *sco_dev = (struct sco_dev *) dev; struct sco_stream_out *out = (struct sco_stream_out *) stream_out; - DBG("dev %p stream %p fd %d", dev, stream_out, sco_dev->out->fd); + DBG("dev %p stream %p fd %d", dev, out, sco_dev->out->fd); - if (sco_dev->out && sco_dev->out->fd) { - close(sco_dev->out->fd); - sco_dev->out->fd = -1; + if (out && out->fd >= 0) { + close(out->fd); + out->fd = -1; } if (out->resampler) -- 2.47.3