diff options
| author | Rios Kao <rioskao@google.com> | 2019-06-28 14:38:31 -0700 |
|---|---|---|
| committer | Rios Kao <rioskao@google.com> | 2019-06-28 14:44:34 -0700 |
| commit | f7abd6569666145f2130ec9b7311920ad7a871ee (patch) | |
| tree | ffcfffcd4d5e78cc72e08491bad0600df31ba27a | |
| parent | 32d5a9594517f544a3b2b49cae6f264c3399e244 (diff) | |
| download | android_hardware_knowles_athletico_sound_trigger_hal-f7abd6569666145f2130ec9b7311920ad7a871ee.tar.gz android_hardware_knowles_athletico_sound_trigger_hal-f7abd6569666145f2130ec9b7311920ad7a871ee.tar.bz2 android_hardware_knowles_athletico_sound_trigger_hal-f7abd6569666145f2130ec9b7311920ad7a871ee.zip | |
sthal: fix incorrect error handle
note: The incorrect handle make the mistake to free
the necessary model data.
Test: manually test by test APK
Bug: 136213148
Change-Id: I1ce9872154f3306bcde6b621c9b8898c1f9e5b5f
| -rw-r--r-- | sound_trigger_hw_iaxxx.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sound_trigger_hw_iaxxx.c b/sound_trigger_hw_iaxxx.c index 4519f81..89949a2 100644 --- a/sound_trigger_hw_iaxxx.c +++ b/sound_trigger_hw_iaxxx.c @@ -2405,7 +2405,7 @@ static int stdev_load_sound_model(const struct sound_trigger_hw_device *dev, ret = start_sensor_model(stdev); if (ret) { ALOGE("%s: ERROR: Failed to start sensor model", __func__); - goto exit; + goto error; } stdev->models[i].kw_id = USELESS_KW_ID; } else if (check_uuid_equality(sound_model->vendor_uuid, @@ -2413,13 +2413,13 @@ static int stdev_load_sound_model(const struct sound_trigger_hw_device *dev, ret = start_chre_model(stdev, i); if (ret) { ALOGE("%s: ERROR: Failed to start chre model", __func__); - goto exit; + goto error; } stdev->models[i].kw_id = USELESS_KW_ID; } else { ALOGE("%s: ERROR: unknown keyword model file", __func__); ret = -EINVAL; - goto exit; + goto error; } *handle = i; @@ -2436,7 +2436,7 @@ static int stdev_load_sound_model(const struct sound_trigger_hw_device *dev, stdev->models[i].is_loaded = true; -exit: +error: if (ret != 0) { if (stdev->models[i].data) { free(stdev->models[i].data); @@ -2448,6 +2448,8 @@ exit: stdev->is_buffer_package_loaded = false; } } + +exit: pthread_mutex_unlock(&stdev->lock); ALOGD("-%s handle %d-", __func__, *handle); return ret; |
