From: Andrei Emeltchenko <[email protected]>
Fixes clang warning:
...
android/hal-audio.c:484:3: warning: Potential leak of memory pointed to
by 'preset'
...
---
android/hal-audio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/android/hal-audio.c b/android/hal-audio.c
index 439b583..83ea739 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -482,7 +482,7 @@ static bool open_endpoint(struct audio_endpoint **epp,
if (!ep) {
error("Cound not find opened endpoint");
- return false;
+ goto failed;
}
*epp = ep;
@@ -516,7 +516,8 @@ static bool open_endpoint(struct audio_endpoint **epp,
return true;
failed:
- close(fd);
+ if (fd >= 0)
+ close(fd);
free(preset);
return false;
--
1.8.3.2
Hi Andrei,
On Fri, Jun 6, 2014 at 10:19 AM, Andrei Emeltchenko
<[email protected]> wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> Fixes clang warning:
> ...
> android/hal-audio.c:484:3: warning: Potential leak of memory pointed to
> by 'preset'
> ...
> ---
> android/hal-audio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/android/hal-audio.c b/android/hal-audio.c
> index 439b583..7a40682 100644
> --- a/android/hal-audio.c
> +++ b/android/hal-audio.c
> @@ -482,7 +482,7 @@ static bool open_endpoint(struct audio_endpoint **epp,
>
> if (!ep) {
> error("Cound not find opened endpoint");
> - return false;
> + goto failed;
> }
>
> *epp = ep;
> --
> 1.8.3.2
Pushed, thanks.
--
Luiz Augusto von Dentz
From: Andrei Emeltchenko <[email protected]>
Fixes clang warning:
...
android/hal-audio.c:484:3: warning: Potential leak of memory pointed to
by 'preset'
...
---
android/hal-audio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/hal-audio.c b/android/hal-audio.c
index 439b583..7a40682 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -482,7 +482,7 @@ static bool open_endpoint(struct audio_endpoint **epp,
if (!ep) {
error("Cound not find opened endpoint");
- return false;
+ goto failed;
}
*epp = ep;
--
1.8.3.2