[llvm] r211184 - Fix a memory leak in the error path.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jun 18 11:19:41 PDT 2014


> Is it possible to split this in to two APIs rather than a bool
> parameter of "BufferOwned" & then use std::unique_ptr?

Maybe, but I don't see why that would be better.  We would have to
propagate the change up or callers would have to do

if (BufferOwned)
 return  createELFObjectFileOwned()
else
  return createELFObjectFile()

The aux function makes it clear the buffer is deleted and allows for
the runtime parameter.

Cheers,
Rafael



More information about the llvm-commits mailing list