Merge "effects: fix a theoretical memory leak" am: 7f4beda2de am: 139b5728e2
Change-Id: Idac6217b6be23b138dda448f470443de28326189
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index ee7a6d6..641f3ec 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -1856,12 +1856,13 @@
}
// copy to local memory in case of client corruption b/32220769
- param = (effect_param_t *)realloc(param, size);
- if (param == NULL) {
+ auto *newParam = (effect_param_t *)realloc(param, size);
+ if (newParam == NULL) {
ALOGW("command(): out of memory");
status = NO_MEMORY;
break;
}
+ param = newParam;
memcpy(param, p, size);
int reply = 0;