Skip to content

Commit 7f40d69

Browse files
Coverity Fix: Free allocated memory before pointer is lost
1 parent f988ae0 commit 7f40d69

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/acl_hal_mmd.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,14 @@ cl_bool l_load_single_board_library(const char *library_name,
623623
if (result == CL_FALSE) {
624624
std::cout << "Error: Could not load board library " << library_name
625625
<< " due to failure to load symbols\n";
626+
my_dlclose(mmd_library);
626627
return result;
627628
}
628629
}
629630
++num_boards_found;
630631
}
631632

633+
my_dlclose(mmd_library);
632634
return CL_TRUE;
633635
}
634636

@@ -1184,6 +1186,7 @@ static acl_mmd_dispatch_t *get_msim_mmd_layer() {
11841186
return nullptr;
11851187
}
11861188
auto *sym = my_dlsym(mmd_lib, sym_name, &error_msg);
1189+
my_dlclose(mmd_lib);
11871190
if (!sym) {
11881191
std::cout << "Error: Symbol " << sym_name
11891192
<< " not found in simulation MMD library ";

0 commit comments

Comments
 (0)