diff --git a/projects/clr/hipamd/src/hip_fatbin.cpp b/projects/clr/hipamd/src/hip_fatbin.cpp index c75e9110b9..2a1c1777b4 100644 --- a/projects/clr/hipamd/src/hip_fatbin.cpp +++ b/projects/clr/hipamd/src/hip_fatbin.cpp @@ -53,7 +53,7 @@ FatBinaryInfo::~FatBinaryInfo() { if (!HIP_USE_RUNTIME_UNBUNDLER) { // Using COMGR Unbundler - if (ufd_ && ufd_->fdesc_ > 0) { + if (ufd_ && amd::Os::isValidFileDesc(ufd_->fdesc_)) { // Check for ufd_ != nullptr, since sometimes, we never create unique_file_desc. if (ufd_->fsize_ && image_mapped_ && !amd::Os::MemoryUnmapFile(image_, ufd_->fsize_)) { @@ -282,7 +282,7 @@ hipError_t FatBinaryInfo::ExtractFatBinaryUsingCOMGR(const std::vector 0) { + if (amd::Os::isValidFileDesc(fdesc_)) { guarantee(fsize_ > 0, "Size has to greater than 0 too"); if (!amd::Os::CloseFileHandle(fdesc_)) guarantee(false, "Cannot close the file handle");