summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaruch Eruchimovitch <baruche@codeaurora.org>2013-11-02 21:36:11 +0200
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:29:23 -0600
commit01223d41d21a616555e11dc09008190b263c4b88 (patch)
treeb3cd340e1f4f612152e274c4f56568bb5995aee3
parent9e7569d263e6d5fa0656729b418640bf6cd030a5 (diff)
downloadandroid_system_media-01223d41d21a616555e11dc09008190b263c4b88.tar.gz
android_system_media-01223d41d21a616555e11dc09008190b263c4b88.tar.bz2
android_system_media-01223d41d21a616555e11dc09008190b263c4b88.zip
Nullify non-initialized entries in the mixer control structure
While initialization process of some internal control structure, some entries can remain non-initialized. To avoid possible crash while the structure release, the non-initialized entries should be zeroed. Change-Id: I2450c9214eeb478cc57feef706d00b10c6897b60
-rw-r--r--audio_route/audio_route.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/audio_route/audio_route.c b/audio_route/audio_route.c
index 029951c1..c14cbf98 100644
--- a/audio_route/audio_route.c
+++ b/audio_route/audio_route.c
@@ -493,8 +493,12 @@ static int alloc_mixer_state(struct audio_route *ar)
/* Skip unsupported types that are not supported yet in XML */
type = mixer_ctl_get_type(ctl);
- if (!is_supported_ctl_type(type))
+ if (!is_supported_ctl_type(type)) {
+ ar->mixer_state[i].old_value = NULL;
+ ar->mixer_state[i].new_value = NULL;
+ ar->mixer_state[i].reset_value = NULL;
continue;
+ }
ar->mixer_state[i].old_value = malloc(num_values * sizeof(int));
ar->mixer_state[i].new_value = malloc(num_values * sizeof(int));