[llvm] bdea159 - Revert "Revert "Fix memory leak in Offloading API" (#161465)" (#161573)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 17:47:52 PDT 2025


Author: David Salinas
Date: 2025-10-01T20:47:47-04:00
New Revision: bdea159093ae2e4482dedb32bca5e03a212fc44f

URL: https://github.com/llvm/llvm-project/commit/bdea159093ae2e4482dedb32bca5e03a212fc44f
DIFF: https://github.com/llvm/llvm-project/commit/bdea159093ae2e4482dedb32bca5e03a212fc44f.diff

LOG: Revert "Revert "Fix memory leak in Offloading API" (#161465)" (#161573)

This reverts commit d392563433316e310edacf35a40fb2f9aa477acc.

Added: 
    

Modified: 
    llvm/lib/Object/OffloadBundle.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Object/OffloadBundle.cpp b/llvm/lib/Object/OffloadBundle.cpp
index 0dd378e65fd81..329dcbf2d939a 100644
--- a/llvm/lib/Object/OffloadBundle.cpp
+++ b/llvm/lib/Object/OffloadBundle.cpp
@@ -120,14 +120,15 @@ OffloadBundleFatBin::create(MemoryBufferRef Buf, uint64_t SectionOffset,
   if (identify_magic(Buf.getBuffer()) != file_magic::offload_bundle)
     return errorCodeToError(object_error::parse_failed);
 
-  OffloadBundleFatBin *TheBundle = new OffloadBundleFatBin(Buf, FileName);
+  std::unique_ptr<OffloadBundleFatBin> TheBundle(
+      new OffloadBundleFatBin(Buf, FileName));
 
   // Read the Bundle Entries
   Error Err = TheBundle->readEntries(Buf.getBuffer(), SectionOffset);
   if (Err)
     return Err;
 
-  return std::unique_ptr<OffloadBundleFatBin>(TheBundle);
+  return std::move(TheBundle);
 }
 
 Error OffloadBundleFatBin::extractBundle(const ObjectFile &Source) {


        


More information about the llvm-commits mailing list