[llvm] r269336 - [obj2yaml] Fix ASAN bot failure
Chris Bieneman via llvm-commits
llvm-commits at lists.llvm.org
Thu May 12 12:57:08 PDT 2016
Author: cbieneman
Date: Thu May 12 14:57:07 2016
New Revision: 269336
URL: http://llvm.org/viewvc/llvm-project?rev=269336&view=rev
Log:
[obj2yaml] Fix ASAN bot failure
I was leaking out of a unique_ptr, should have just kept it in the unique_ptr.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/12738/steps/check-llvm%20asan/logs/stdio
Modified:
llvm/trunk/tools/obj2yaml/macho2yaml.cpp
Modified: llvm/trunk/tools/obj2yaml/macho2yaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/macho2yaml.cpp?rev=269336&r1=269335&r2=269336&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/macho2yaml.cpp (original)
+++ llvm/trunk/tools/obj2yaml/macho2yaml.cpp Thu May 12 14:57:07 2016
@@ -21,10 +21,10 @@ class MachODumper {
public:
MachODumper(const object::MachOObjectFile &O) : Obj(O) {}
- Expected<MachOYAML::Object *> dump();
+ Expected<std::unique_ptr<MachOYAML::Object> > dump();
};
-Expected<MachOYAML::Object *> MachODumper::dump() {
+Expected<std::unique_ptr<MachOYAML::Object> > MachODumper::dump() {
auto Y = make_unique<MachOYAML::Object>();
Y->Header.magic = Obj.getHeader().magic;
Y->Header.cputype = Obj.getHeader().cputype;
@@ -34,12 +34,12 @@ Expected<MachOYAML::Object *> MachODumpe
Y->Header.sizeofcmds = Obj.getHeader().sizeofcmds;
Y->Header.flags = Obj.getHeader().flags;
- return Y.release();
+ return std::move(Y);
}
Error macho2yaml(raw_ostream &Out, const object::MachOObjectFile &Obj) {
MachODumper Dumper(Obj);
- Expected<MachOYAML::Object *> YAML = Dumper.dump();
+ Expected<std::unique_ptr<MachOYAML::Object> > YAML = Dumper.dump();
if (!YAML)
return YAML.takeError();
More information about the llvm-commits
mailing list