Skip to content

Commit 3e1c5ea

Browse files
haoxian2zibaiwan
authored andcommitted
Fixed coverity in acl_program.cpp: Use after free (USE_AFTER_FREE)
1 parent f510b0a commit 3e1c5ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/acl_program.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,14 +1819,16 @@ static cl_int l_build_from_source_in_dir(acl_device_program_info_t *dev_prog,
18191819
if (status == CL_SUCCESS && context->compiles_programs) {
18201820
for (unsigned i = 0; i < num_build_cmds; i++) {
18211821
struct acl_file_handle_t *cmdfp = acl_fopen(cmdfile[i], "wb");
1822+
if (debug_mode > 0) {
1823+
printf(" cmdfp %p\n", cmdfp);
1824+
}
18221825
size_t bytes_written = 0;
18231826
if (cmdfp) {
18241827
bytes_written = (size_t)acl_fprintf(cmdfp, "%s", cmd[i].c_str());
18251828
acl_fclose(cmdfp); // close in any case.
18261829
}
18271830
if (!cmdfp || (cmd[i].length() != bytes_written)) {
18281831
if (debug_mode > 0) {
1829-
printf(" cmdfp %p\n", cmdfp);
18301832
printf(" cmdlen %d bw %d\n", (int)cmd[i].length(),
18311833
(int)bytes_written);
18321834
}

0 commit comments

Comments
 (0)