Skip to content

Commit ed82252

Browse files
committed
Fix memory leak.
1 parent 03c2469 commit ed82252

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/lib/SYCLLowerIR/ESIMD/ESIMDVerifier.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ class ESIMDVerifierImpl {
159159
Name.starts_with("sycl::_V1::ext::intel::esimd::") ||
160160
Name.starts_with(
161161
"sycl::_V1::ext::intel::experimental::esimd::") ||
162-
Name.starts_with("sycl::_V1::ext::oneapi::this_work_item::"))
162+
Name.starts_with("sycl::_V1::ext::oneapi::this_work_item::")) {
163+
std::free(NameBuf.getBuffer());
163164
continue;
165+
}
164166

165167
// Check if function name matches any allowed SYCL function name.
166168
auto checkLegalFunc = [Name](const char *LegalName) {
@@ -175,9 +177,12 @@ class ESIMDVerifierImpl {
175177
// lowered to buffer_t will cause runtime error and thus must be
176178
// reported at compilation time.
177179
(MayNeedForceStatelessMemModeAPI &&
178-
any_of(LegalSYCLFunctionsInStatelessMode, checkLegalFunc)))
180+
any_of(LegalSYCLFunctionsInStatelessMode, checkLegalFunc))) {
181+
std::free(NameBuf.getBuffer());
179182
continue;
183+
}
180184

185+
std::free(NameBuf.getBuffer());
181186
// If not, report an error.
182187
std::string ErrorMsg = std::string("function '") +
183188
demangle(MangledName.str()) +

0 commit comments

Comments
 (0)