diff options
author | David CARLIER <devnexen@gmail.com> | 2024-02-10 19:14:28 +0000 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2024-02-20 12:59:02 -0800 |
commit | 390dcd4cbbf511954ba1e0ca000d3e1c6394060e (patch) | |
tree | 81beb462d26c65b7ff06281b898a6752915ed118 /compiler-rt | |
parent | 3b4b0476423e2340cf6ef370df3c98420014c97b (diff) | |
download | llvm-390dcd4cbbf511954ba1e0ca000d3e1c6394060e.zip llvm-390dcd4cbbf511954ba1e0ca000d3e1c6394060e.tar.gz llvm-390dcd4cbbf511954ba1e0ca000d3e1c6394060e.tar.bz2 |
[compiler-rt][profile] Fix InstrProfilingFile possible resource leak. (#81363)
close #79708
(cherry picked from commit 0a255fcf4a90f9e864ae9321b28e4956f7c865fb)
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/profile/InstrProfilingFile.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index 867ae73..f3b457d 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -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); } } |