Thread (6 messages) 6 messages, 2 authors, 2014-02-02

[PATCH 3/4] android/hal-audio: Fix memory leak

flat view
STALE4637d

From: Andrei Emeltchenko <hidden>
Date: 2014-01-31 14:18:48
Subsystem: the rest · Maintainer: Linus Torvalds

From: Andrei Emeltchenko <redacted>

Free preset if set_blocking() fails.
---
 android/hal-audio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/android/hal-audio.c b/android/hal-audio.c
index 4b80da8..dfe8b68 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -1176,8 +1176,10 @@ static int audio_open_output_stream(struct audio_hw_device *dev,
 	if (!preset || fd < 0)
 		goto fail;
 
-	if (set_blocking(fd) < 0)
+	if (set_blocking(fd) < 0) {
+		free(preset);
 		goto fail;
+	}
 
 	out->ep->fd = fd;
 	codec = out->ep->codec;
-- 
1.8.3.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help