llvm-dis: Fix memory leak. ParseBitcodeFile should be taking ownership of

the MemoryBuffer*, however, it doesn't seem to delete it.

llvm-svn: 122004
This commit is contained in:
Michael J. Spencer 2010-12-16 22:37:52 +00:00
parent 7ed7afc8b7
commit a646f39c67
1 changed files with 7 additions and 5 deletions

View File

@ -80,12 +80,14 @@ int main(int argc, char **argv) {
std::string ErrorMessage;
std::auto_ptr<Module> M;
OwningPtr<MemoryBuffer> BufferPtr;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
ErrorMessage = ec.message();
else
M.reset(ParseBitcodeFile(BufferPtr.take(), Context, &ErrorMessage));
{
OwningPtr<MemoryBuffer> BufferPtr;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
ErrorMessage = ec.message();
else
M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
}
if (M.get() == 0) {
errs() << argv[0] << ": ";