diff -Nru android-20140328-2310/debian/changelog android-20140328-2310/debian/changelog --- android-20140328-2310/debian/changelog 2014-03-30 22:50:09.000000000 +0000 +++ android-20140328-2310/debian/changelog 2014-04-11 20:33:02.000000000 +0000 @@ -1,3 +1,11 @@ +android (20140328-2310-0ubuntu2) trusty; urgency=medium + + * audio_hw.c-make-sure-we-don-t-double-free-if-it-s-th.patch: + - Don't double free if the stream is also part of the primary + output channel (LP: #1306797) + + -- Ricardo Salveti de Araujo Fri, 11 Apr 2014 17:32:15 -0300 + android (20140328-2310-0ubuntu1) trusty; urgency=medium * New upstream release: diff -Nru android-20140328-2310/debian/patches/audio_hw.c-make-sure-we-don-t-double-free-if-it-s-th.patch android-20140328-2310/debian/patches/audio_hw.c-make-sure-we-don-t-double-free-if-it-s-th.patch --- android-20140328-2310/debian/patches/audio_hw.c-make-sure-we-don-t-double-free-if-it-s-th.patch 1970-01-01 00:00:00.000000000 +0000 +++ android-20140328-2310/debian/patches/audio_hw.c-make-sure-we-don-t-double-free-if-it-s-th.patch 2014-04-11 20:34:32.000000000 +0000 @@ -0,0 +1,39 @@ +From 86fa8057b8944982f3d74bc51dd4db116d950904 Mon Sep 17 00:00:00 2001 +From: Ricardo Salveti de Araujo +Date: Fri, 11 Apr 2014 17:02:47 -0300 +Subject: [PATCH] audio_hw.c: make sure we don't double free if it's the + primary output + +Change-Id: Ifd85d3d0489d487cdd80dcd9fe1f930f559a47f7 +Signed-off-by: Ricardo Salveti de Araujo +--- + hardware/qcom/audio/hal/audio_hw.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/hardware/qcom/audio/hal/audio_hw.c b/hardware/qcom/audio/hal/audio_hw.c +index a74592f..6d79090 100644 +--- a/hardware/qcom/audio/hal/audio_hw.c ++++ b/hardware/qcom/audio/hal/audio_hw.c +@@ -2025,10 +2025,18 @@ static void adev_close_output_stream(struct audio_hw_device *dev, + pthread_cond_destroy(&out->cond); + pthread_mutex_destroy(&out->lock); + if (adev->primary_output != NULL) { ++ /* Stream is part of primary_output, so check if not causing a ++ * double free when releasing the stream */ ++ ALOGI("%s: stream is the primary output", __func__); ++ if (&adev->primary_output->stream != stream) ++ free(stream); + free(adev->primary_output); + adev->primary_output = NULL; ++ } else { ++ /* In case we're not the primary output, just release the stream */ ++ ALOGI("%s: stream is not the primary output", __func__); ++ free(stream); + } +- free(stream); + ALOGI("%s: exit", __func__); + } + +-- +1.9.1 + diff -Nru android-20140328-2310/debian/patches/series android-20140328-2310/debian/patches/series --- android-20140328-2310/debian/patches/series 2014-03-30 21:42:16.000000000 +0000 +++ android-20140328-2310/debian/patches/series 2014-04-11 20:32:05.000000000 +0000 @@ -2,3 +2,6 @@ disable-tests.patch emulator-disabling-translator-libs-for-64-bits.patch disable-x86-stack-protector.patch + +# from upstream +audio_hw.c-make-sure-we-don-t-double-free-if-it-s-th.patch