diff options
author | George Burgess IV <gbiv@google.com> | 2016-12-13 15:32:00 -0800 |
---|---|---|
committer | George Burgess IV <gbiv@google.com> | 2016-12-13 15:32:00 -0800 |
commit | 5572d1607bf145c59b830b24e152e030094646bc (patch) | |
tree | dcc5c1720ecf90ae00567402671e4b2a060e90b6 | |
parent | fbeacb02c0fe331242dd1815a28e2b2f1d5a42c6 (diff) |
Fix a memory leak.
This was caught by clang's static analyzer. Warning:
frameworks/base/media/mca/filterfw/native/core/shader_program.cpp:1031:3:
warning: Potential leak of memory pointed to by 'attrib.owned_data'
return StoreAttribute(attrib);
Bug: None.
Test: The static analyzer no longer complains.
Change-Id: Ibef0368dfa48ba57e38019a5a3e33d5bacd847a2
-rw-r--r-- | media/mca/filterfw/native/core/shader_program.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/media/mca/filterfw/native/core/shader_program.cpp b/media/mca/filterfw/native/core/shader_program.cpp index 1e573fbf84a2..d46051292c38 100644 --- a/media/mca/filterfw/native/core/shader_program.cpp +++ b/media/mca/filterfw/native/core/shader_program.cpp @@ -1028,7 +1028,11 @@ bool ShaderProgram::SetAttributeValues(ProgramVar var, attrib.values = data_cpy; attrib.owned_data = data_cpy; // Marks this for deletion later on - return StoreAttribute(attrib); + if (StoreAttribute(attrib)) + return true; + // If storing this failed, then it won't be deleted on its own. + delete[] data_cpy; + return false; } bool ShaderProgram::StoreAttribute(VertexAttrib attrib) { |