FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

A possible resource leak in Python 3.11.0 · Issue #98872 · python/cpython · GitHub

/ cpython Public

A possible resource leak in Python 3.11.0 #98872

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL