From 78d5ad84b49674cbae4772170138150d602803e3 Mon Sep 17 00:00:00 2001 From: david-salinas Date: Wed, 1 Oct 2025 19:35:52 +0000 Subject: [PATCH 1/2] Revert "Revert "Fix memory leak in Offloading API" (#161465)" This reverts commit d392563433316e310edacf35a40fb2f9aa477acc. --- llvm/lib/Object/OffloadBundle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Object/OffloadBundle.cpp b/llvm/lib/Object/OffloadBundle.cpp index 0dd378e65fd81..a6a9628acddcc 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 TheBundle( + new OffloadBundleFatBin(Buf, FileName)); // Read the Bundle Entries Error Err = TheBundle->readEntries(Buf.getBuffer(), SectionOffset); if (Err) return Err; - return std::unique_ptr(TheBundle); + return TheBundle; } Error OffloadBundleFatBin::extractBundle(const ObjectFile &Source) { From 593be0baefc5a07e769e97b0e013bf52fdef4c00 Mon Sep 17 00:00:00 2001 From: david-salinas Date: Wed, 1 Oct 2025 20:50:30 +0000 Subject: [PATCH 2/2] resolve openmp build bot error --- llvm/lib/Object/OffloadBundle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Object/OffloadBundle.cpp b/llvm/lib/Object/OffloadBundle.cpp index a6a9628acddcc..329dcbf2d939a 100644 --- a/llvm/lib/Object/OffloadBundle.cpp +++ b/llvm/lib/Object/OffloadBundle.cpp @@ -128,7 +128,7 @@ OffloadBundleFatBin::create(MemoryBufferRef Buf, uint64_t SectionOffset, if (Err) return Err; - return TheBundle; + return std::move(TheBundle); } Error OffloadBundleFatBin::extractBundle(const ObjectFile &Source) {