From 69a8e1c3fb14f14699798665f38fbf6d517f2cf7 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 31 Jan 2014 16:18:48 +0200 Subject: [PATCH] android/hal-audio: Fix memory leak 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 a6347afea..a2601fd48 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -1179,8 +1179,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; -- 2.47.3