Commit 83a6bb93 by Nicolas Capens

Fix memory leak of Subzero global inits.

getGlobalInits() moves ownership of a unique_ptr<>, which we released to obtain the raw pointer, but we didn't delete it afterwards. This is fixed by keeping the unique_ptr<> and having it freed at the end of the scope. Bug chromium:732739 Change-Id: I4d8c9367f34790944daabc0417af08eb4b4c7c2e Reviewed-on: https://swiftshader-review.googlesource.com/10409Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 619a8c5a
......@@ -587,11 +587,11 @@ namespace sw
::function->translate();
assert(!::function->hasError());
auto *globals = ::function->getGlobalInits().release();
auto globals = ::function->getGlobalInits();
if(globals && !globals->empty())
{
::context->getGlobals()->merge(globals);
::context->getGlobals()->merge(globals.get());
}
::context->emitFileHeader();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment