Skip to content

Commit 1b4b914

Browse files
authored
Fix memory leak in create_module function in sycl_functions.h (#5085)
1 parent e93c6b8 commit 1b4b914

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

third_party/intel/backend/include/sycl_functions.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ create_module(ze_context_handle_t context, ze_device_handle_t device,
167167
size_t szLog = 0;
168168
ZE_CHECK(zeModuleBuildLogGetString(buildlog, &szLog, nullptr));
169169
char *strLog = (char *)malloc(szLog);
170-
ZE_CHECK(zeModuleBuildLogGetString(buildlog, &szLog, strLog));
170+
auto error_no_build_log =
171+
zeModuleBuildLogGetString(buildlog, &szLog, strLog);
172+
if (error_no_build_log != ZE_RESULT_SUCCESS) {
173+
free(strLog);
174+
ZE_CHECK(error_no_build_log);
175+
}
171176
std::cerr << "L0 build module failed. Log: " << strLog << std::endl;
172177
free(strLog);
173178
ZE_CHECK(zeModuleBuildLogDestroy(buildlog));

0 commit comments

Comments
 (0)