summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-05-02 11:24:19 -0700
committerEric Laurent <elaurent@google.com>2012-05-02 11:24:19 -0700
commit33b42ef53271e2e4e6a139aec350b595f659c4e8 (patch)
treea26429beeaada2829b119d6be95d60f1ff32477f /audio
parent2b4b692c72a0d0ea170f011069b4e52bf6243a4e (diff)
downloaddevice_samsung_tuna-33b42ef53271e2e4e6a139aec350b595f659c4e8.zip
device_samsung_tuna-33b42ef53271e2e4e6a139aec350b595f659c4e8.tar.gz
device_samsung_tuna-33b42ef53271e2e4e6a139aec350b595f659c4e8.tar.bz2
audio: fix memory leak.
Fixed memory leak introduced by commit 4e7a573f in case of error in adev_open_output_stream(). Change-Id: I4acc070d748cea228da846f95c7826160e0196a5
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 7a24bcf..b507a59 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -2899,16 +2899,20 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
if (flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) {
ALOGV("adev_open_output_stream() deep buffer");
- if (ladev->outputs[OUTPUT_DEEP_BUF] != NULL)
- return -ENOSYS;
+ if (ladev->outputs[OUTPUT_DEEP_BUF] != NULL) {
+ ret = -ENOSYS;
+ goto err_open;
+ }
output_type = OUTPUT_DEEP_BUF;
out->stream.common.get_buffer_size = out_get_buffer_size_deep_buffer;
out->stream.get_latency = out_get_latency_deep_buffer;
out->stream.write = out_write_deep_buffer;
} else {
ALOGV("adev_open_output_stream() normal buffer");
- if (ladev->outputs[OUTPUT_LOW_LATENCY] != NULL)
- return -ENOSYS;
+ if (ladev->outputs[OUTPUT_LOW_LATENCY] != NULL) {
+ ret = -ENOSYS;
+ goto err_open;
+ }
output_type = OUTPUT_LOW_LATENCY;
out->stream.common.get_buffer_size = out_get_buffer_size_low_latency;
out->stream.get_latency = out_get_latency_low_latency;