This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: winreg: SetValueEx leaks memory if PySys_Audit fails
Type: resource usage Stage: resolved
Components: Windows Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, corona10, miss-islington, nulano, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2021-03-27 08:16 by nulano, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25038 merged ZackerySpytz, 2021-03-27 14:44
PR 25093 merged miss-islington, 2021-03-30 06:22
PR 25094 merged miss-islington, 2021-03-30 06:23
Messages (3)
msg389591 - (view) Author: Ondrej Baranovič (nulano) Date: 2021-03-27 08:16
The function `winreg_SetValueEx_impl` in `winreg.c`:

1) Allocates memory by calling `Py2Reg`,
2) calls `PySys_Audit` and immediately returns if it indicates an error,
3) calls `RegSetValueExW`,
4) frees memory allocated in (1) and returns.

The if-block in (2) should free the memory allocated in (1) if an audit hook raises.

Introduced in PR17541.
msg389792 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-03-30 06:22
New changeset dfeec347f21b86879ba8f27f567bb275b243f1bc by Zackery Spytz in branch 'master':
bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038)
https://github.com/python/cpython/commit/dfeec347f21b86879ba8f27f567bb275b243f1bc
msg389799 - (view) Author: miss-islington (miss-islington) Date: 2021-03-30 07:52
New changeset f79577ddbd7c87b6cc1810e98ee4eaca7ae50699 by Miss Islington (bot) in branch '3.9':
bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038)
https://github.com/python/cpython/commit/f79577ddbd7c87b6cc1810e98ee4eaca7ae50699
msg389800 - (view) Author: miss-islington (miss-islington) Date: 2021-03-30 07:52
New changeset 5486b105a4c5de840c24776c726eeac2a8dc973c by Miss Islington (bot) in branch '3.8':
bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038)
https://github.com/python/cpython/commit/5486b105a4c5de840c24776c726eeac2a8dc973c
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87803
2021-03-30 07:52:34corona10setstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-03-30 07:52:23miss-islingtonsetmessages: + msg389800
2021-03-30 07:52:23miss-islingtonsetmessages: + msg389799
2021-03-30 06:23:01miss-islingtonsetpull_requests: + pull_request23839
2021-03-30 06:22:51miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request23838
2021-03-30 06:22:43corona10setnosy: + corona10
messages: + msg389792
2021-03-27 14:44:40ZackerySpytzsetkeywords: + patch
nosy: + ZackerySpytz

pull_requests: + pull_request23786
stage: patch review
2021-03-27 08:16:31nulanocreate