Fix a memory leak
Static analyzer complaint:
frameworks/av/services/audiopolicy/service/AudioPolicyEffects.cpp:551:5:
warning: Potential leak of memory pointed to by 'fx_param'
[clang-analyzer-unix.Malloc]
This is because we unconditionally assign the result of realloc to
param: if realloc fails, it will not free the given pointer value, but
will return NULL. Hence, code like:
bool safeGrowParamSize(char **param, size_t size,
size_t *curSize, size_t *totSize) {
if (growParamSize(param, size, curSize, totSize) == 0) {
free(*param);
return false;
}
return true;
}
...Will fail to free param on failure.
Bug: None
Test: None
Change-Id: I7a430e7965ab29e183c82ebcb298a2ffb42339b1
1 file changed