forked from OSchip/llvm-project
Fix memory leak in MicrosoftDemangleNodes's Node::toString
The buffer we turn into a std::string here is malloc'd and should be free'd before we return from this function. Follow up to LLDB leak fixes such as D100806. Reviewed By: mstorsjo, rupprecht, MaskRay Differential Revision: https://reviews.llvm.org/D100843
This commit is contained in:
parent
803f1e4653
commit
ae209aa9ec
|
@ -120,7 +120,9 @@ std::string Node::toString(OutputFlags Flags) const {
|
|||
initializeOutputStream(nullptr, nullptr, OS, 1024);
|
||||
this->output(OS, Flags);
|
||||
OS << '\0';
|
||||
return {OS.getBuffer()};
|
||||
std::string Owned(OS.getBuffer());
|
||||
std::free(OS.getBuffer());
|
||||
return Owned;
|
||||
}
|
||||
|
||||
void PrimitiveTypeNode::outputPre(OutputStream &OS, OutputFlags Flags) const {
|
||||
|
|
Loading…
Reference in New Issue