-
- Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Hi, I'm currently using Infer, a static analysis tool, to analyze the native code of CPython.
I found a possible resource leak vulnerability:
Resource of type _IO_FILE
acquired by call to fopen()
at line 184 is not released after line 196.
Programs/_freeze_module.c:196:
195. if (ferror(outfile)) { 196. fprintf(stderr, "error when writing to '%s'\n", outpath); ^ 197. return -1; 198. }
I think that resource should be released before exiting, a PR maybe like:
if (ferror(outfile)) { fprintf(stderr, "error when writing to '%s'\n", outpath); fclose(outfile); return -1; }
Python is my favorite programming language. I hope this discovery can be helpful to you!
My environment
- CPython versions tested on: 3.11.0
- Operating system and architecture: Ubuntu 22.04
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error