summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hal/audio_extn/utils.c6
-rw-r--r--hal/audio_hw.c26
2 files changed, 29 insertions, 3 deletions
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 56b7f463..32cdcc85 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2014 The Android Open Source Project
@@ -351,6 +351,7 @@ void audio_extn_utils_update_streams_output_cfg_list(void *platform,
root = config_node("", "");
if (root == NULL) {
ALOGE("cfg_list, NULL config root");
+ free(data);
return;
}
@@ -358,6 +359,9 @@ void audio_extn_utils_update_streams_output_cfg_list(void *platform,
load_output(root, platform, streams_output_cfg_list);
send_app_type_cfg(platform, mixer, streams_output_cfg_list);
+
+ config_free(root);
+ free(data);
}
void audio_extn_utils_dump_streams_output_cfg_list(
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 998954cc..7aa34ca2 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -2125,7 +2125,7 @@ static char* out_get_parameters(const struct audio_stream *stream, const char *k
{
struct stream_out *out = (struct stream_out *)stream;
struct str_parms *query = str_parms_create_str(keys);
- char *str;
+ char *str = (char*) NULL;
char value[256];
struct str_parms *reply = str_parms_create();
size_t i, j;
@@ -2133,6 +2133,12 @@ static char* out_get_parameters(const struct audio_stream *stream, const char *k
bool first = true;
if (!query || !reply) {
+ if (reply) {
+ str_parms_destroy(reply);
+ }
+ if (query) {
+ str_parms_destroy(query);
+ }
ALOGE("out_get_parameters: failed to allocate mem for query or reply");
return NULL;
}
@@ -2178,6 +2184,8 @@ static char* out_get_parameters(const struct audio_stream *stream, const char *k
strlcat(value, "false", sizeof(value));
}
str_parms_add_str(reply, "is_direct_pcm_track", value);
+ if (str)
+ free(str);
str = str_parms_to_str(reply);
}
@@ -2200,6 +2208,8 @@ static char* out_get_parameters(const struct audio_stream *stream, const char *k
i++;
}
str_parms_add_str(reply, AUDIO_PARAMETER_STREAM_SUP_FORMATS, value);
+ if (str)
+ free(str);
str = str_parms_to_str(reply);
}
str_parms_destroy(query);
@@ -2767,6 +2777,12 @@ static char* in_get_parameters(const struct audio_stream *stream,
struct str_parms *reply = str_parms_create();
if (!query || !reply) {
+ if (reply) {
+ str_parms_destroy(reply);
+ }
+ if (query) {
+ str_parms_destroy(query);
+ }
ALOGE("in_get_parameters: failed to create query or reply");
return NULL;
}
@@ -3493,6 +3509,12 @@ static char* adev_get_parameters(const struct audio_hw_device *dev,
int ret = 0;
if (!query || !reply) {
+ if (reply) {
+ str_parms_destroy(reply);
+ }
+ if (query) {
+ str_parms_destroy(query);
+ }
ALOGE("adev_get_parameters: failed to create query or reply");
return NULL;
}