Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 31225688 authored by George Burgess IV's avatar George Burgess IV Committed by George Burgess
Browse files

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
parent e54461ae
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment