mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-31 22:25:56 +00:00
[compiler-rt][profile] Fix InstrProfilingFile possible resource leak. (#81363)
close #79708 (cherry picked from commit 0a255fcf4a90f9e864ae9321b28e4956f7c865fb)
This commit is contained in:
parent
3b4b047642
commit
390dcd4cbb
@ -677,6 +677,7 @@ static void initializeProfileForContinuousMode(void) {
|
||||
PROF_ERR("Continuous counter sync mode is enabled, but raw profile is not"
|
||||
"page-aligned. CurrentFileOffset = %" PRIu64 ", pagesz = %u.\n",
|
||||
(uint64_t)CurrentFileOffset, PageSize);
|
||||
fclose(File);
|
||||
return;
|
||||
}
|
||||
if (writeProfileWithFileObject(Filename, File) != 0) {
|
||||
@ -692,6 +693,8 @@ static void initializeProfileForContinuousMode(void) {
|
||||
|
||||
if (doMerging()) {
|
||||
lprofUnlockFileHandle(File);
|
||||
}
|
||||
if (File != NULL) {
|
||||
fclose(File);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user