forked from OSchip/llvm-project
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:
parent
7ed7afc8b7
commit
a646f39c67
|
@ -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] << ": ";
|
||||
|
|
Loading…
Reference in New Issue