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

Commit 62878159 authored by George Burgess IV's avatar George Burgess IV Committed by Zhao Wei Liew
Browse files

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
parent afe0edd0
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -1028,7 +1028,11 @@ bool ShaderProgram::SetAttributeValues(ProgramVar var,
  attrib.values = data_cpy;
  attrib.values = data_cpy;
  attrib.owned_data = data_cpy; // Marks this for deletion later on
  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) {
bool ShaderProgram::StoreAttribute(VertexAttrib attrib) {