From 446cf08b06eee9907e2eaf9df9dc01bc895904c8 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Tue, 3 Jun 2025 10:53:05 -0700 Subject: Fix the memory leak (#7290) When we return a raw point to a module, we should decrement the reference count. The module is owned by its session so it should be valid as long as the session is valid. --- source/slang/slang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index bda847815..9aa8c56a7 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -1601,7 +1601,7 @@ slang::IModule* Linkage::loadModuleFromBlob( RefPtr module = loadModuleImpl(name, pathInfo, source, SourceLoc(), &sink, nullptr, blobType); sink.getBlobIfNeeded(outDiagnostics); - return asExternal(module.detach()); + return asExternal(module.get()); } catch (const AbortCompilationException& e) { -- cgit v1.2.3