Merge "effects: fix a theoretical memory leak" am: 7f4beda2de am: 139b5728e2 am: a2c8dc480a
Change-Id: I75906bf23cf7f6fcc1d48a106a5926714e1103dc
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 4d37c94..1356123 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -1830,12 +1830,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;