[Python-checkins] bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038)

miss-islington webhook-mailer at python.org
Tue Mar 30 03:52:24 EDT 2021


https://github.com/python/cpython/commit/f79577ddbd7c87b6cc1810e98ee4eaca7ae50699
commit: f79577ddbd7c87b6cc1810e98ee4eaca7ae50699
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-03-30T00:51:55-07:00
summary:

bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038)

(cherry picked from commit dfeec347f21b86879ba8f27f567bb275b243f1bc)

Co-authored-by: Zackery Spytz <zspytz at gmail.com>

files:
M PC/winreg.c

diff --git a/PC/winreg.c b/PC/winreg.c
index 01e3e9f14ba2f..fd1ccb7b83e80 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -1788,6 +1788,7 @@ winreg_SetValueEx_impl(PyObject *module, HKEY key,
     if (PySys_Audit("winreg.SetValue", "nunO",
                     (Py_ssize_t)key, value_name, (Py_ssize_t)type,
                     value) < 0) {
+        PyMem_Free(data);
         return NULL;
     }
     Py_BEGIN_ALLOW_THREADS



More information about the Python-checkins mailing list