Skip to content

gh-133597: Fix memory leak if error occurred in _sys_getwindowsversion_from_kernel32 #133598

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

Conversation

sergey-miryanov
Copy link
Contributor

@sergey-miryanov sergey-miryanov commented May 7, 2025

If GetFileVersionInfoW or VerQueryValueW fails inside _sys_getwindowsversion_from_kernel32 then allocated verblock not freed.

@sergey-miryanov
Copy link
Contributor Author

I believe this PR may skip news.

@Eclips4
Copy link
Member

Eclips4 commented May 7, 2025

FYI, Sergey, the CI fails due to the recent beta(3.14b1) release. I'll restart it later.

@sergey-miryanov
Copy link
Contributor Author

Thanks! Yeah, I saw a possible fix #133599

@Eclips4 Eclips4 added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels May 7, 2025
@Eclips4 Eclips4 requested a review from zooba May 8, 2025 07:09
@zooba zooba merged commit 0ec8fc8 into python:main May 8, 2025
42 checks passed
@miss-islington-app
Copy link

Thanks @sergey-miryanov for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 8, 2025
…version_from_kernel32 (pythonGH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 8, 2025
…version_from_kernel32 (pythonGH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented May 8, 2025

GH-133659 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label May 8, 2025
@bedevere-app
Copy link

bedevere-app bot commented May 8, 2025

GH-133660 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label May 8, 2025
zooba pushed a commit that referenced this pull request May 8, 2025
…n_from_kernel32 (GH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
zooba pushed a commit that referenced this pull request May 8, 2025
…n_from_kernel32 (GH-133598)

(cherry picked from commit 0ec8fc8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Debian root 3.14 (tier-1) has failed when building commit caeb422.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1742/builds/11) and take a look at the build logs.
  4. Check if the failure is related to this commit (caeb422) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1742/builds/11

Failed tests:

  • test_tokenize

Failed subtests:

  • test_random_files - test.test_tokenize.TestRoundtrip.test_random_files

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_tokenize.py", line 2021, in test_random_files
    self.check_roundtrip(f)
    ~~~~~~~~~~~~~~~~~~~~^^^
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/test/test_tokenize.py", line 1869, in check_roundtrip
    untokenized_code = tokenize.untokenize(tokenize.tokenize(readline))
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 341, in untokenize
    out = ut.untokenize(iterable)
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 229, in untokenize
    for t in it:
             ^^
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 492, in tokenize
    yield from _generate_tokens_from_c_tokenizer(rl_gen.__next__, encoding, extra_tokens=True)
  File "/root/buildarea/3.14.angelico-debian-amd64/build/Lib/tokenize.py", line 583, in _generate_tokens_from_c_tokenizer
    yield TokenInfo._make(info)
          ^^^^^^^^^^^^^^^
AttributeError: type object 'TokenInfo' has no attribute '_tokenize'

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

Successfully merging this pull request may close these issues.

5 participants