audio: Fix memory leak when preprocessing is disabled
Change-Id: Ia168de215200ae9e1f4740cf5623b39058b3797c
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 5aaaeb2..6e6a71a 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -4000,6 +4000,16 @@
/* prevent concurrent out_set_parameters, or out_write from standby */
pthread_mutex_lock(&adev->lock_inputs);
+ if (in->read_buf) {
+ free(in->read_buf);
+ in->read_buf = NULL;
+ }
+
+ if (in->resampler) {
+ release_resampler(in->resampler);
+ in->resampler = NULL;
+ }
+
#ifdef PREPROCESSING_ENABLED
int i;
@@ -4007,11 +4017,6 @@
free(in->preprocessors[i].channel_configs);
}
- if (in->read_buf) {
- free(in->read_buf);
- in->read_buf = NULL;
- }
-
if (in->proc_buf_in) {
free(in->proc_buf_in);
in->proc_buf_in = NULL;
@@ -4027,10 +4032,6 @@
in->ref_buf = NULL;
}
- if (in->resampler) {
- release_resampler(in->resampler);
- in->resampler = NULL;
- }
#endif
in_standby_l(in);