[PATCH] D13061: [Bug 21681] - Fixed: Memory leak in FileArchive::find()

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 14:42:17 PDT 2015


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: ReaderWriter/ELF/OutputELFWriter.cpp:49-56
@@ -50,1 +48,10 @@
+
+    // If atoms were added - return the file but also store it for later destruction
+    if (_file->hasAtoms()) {
+      File *result = _file.get();
+      _returnedFiles.push_back(std::move(_file));
+      return result;
+    }
+
+    return nullptr;
   }
----------------
Let's return early.


  if (_file->hasAtom())
    return nullptr;
  ...


http://reviews.llvm.org/D13061





More information about the llvm-commits mailing list