Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler-rt/lib/profile/InstrProfilingFile.c:680:7: error: Resource leak #79708

Closed
dcb314 opened this issue Jan 27, 2024 · 1 comment · Fixed by #81363
Closed

compiler-rt/lib/profile/InstrProfilingFile.c:680:7: error: Resource leak #79708

dcb314 opened this issue Jan 27, 2024 · 1 comment · Fixed by #81363

Comments

@dcb314
Copy link

dcb314 commented Jan 27, 2024

Source code is

if (CurrentFileOffset % PageSize != 0) {
  PROF_ERR("Continuous counter sync mode is enabled, but raw profile is not"
           "page-aligned. CurrentFileOffset = %" PRIu64 ", pagesz = %u.\n",
           (uint64_t)CurrentFileOffset, PageSize);
  return;
}
if (writeProfileWithFileObject(Filename, File) != 0) {
  fclose(File);
  return;
}

If it's worth calling fclose in the second if, then it is worthwhile in the first.

@devnexen
Copy link
Member

Thanks @dcb314 for reporting

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 11, 2024
llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants