summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2014-03-13 16:38:20 (GMT)
committerJesus Cea <jcea@jcea.es>2014-03-13 16:38:20 (GMT)
commit58c767fa3046d00db1b853c3e9a26785d0b3ac8c (patch)
treeba164c91ae725c01c9281bc38ac243fdbb138008 /PC
parentd73721a7e46c6b978250789de5e483669cfe5a0e (diff)
parent782c4cf1553e46fdfbabc4bf627721a5df32ca55 (diff)
downloadcpython-58c767fa3046d00db1b853c3e9a26785d0b3ac8c.zip
cpython-58c767fa3046d00db1b853c3e9a26785d0b3ac8c.tar.gz
cpython-58c767fa3046d00db1b853c3e9a26785d0b3ac8c.tar.bz2
MERGE: Closes #20908: Memory leak in Reg2Py()
Diffstat (limited to 'PC')
-rw-r--r--PC/winreg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/PC/winreg.c b/PC/winreg.c
index 563a3eb..7671317 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -943,8 +943,10 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
fixupMultiSZ(str, data, len);
obData = PyList_New(s);
- if (obData == NULL)
+ if (obData == NULL) {
+ free(str);
return NULL;
+ }
for (index = 0; index < s; index++)
{
size_t len = wcslen(str[index]);
@@ -952,6 +954,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
PyErr_SetString(PyExc_OverflowError,
"registry string is too long for a Python string");
Py_DECREF(obData);
+ free(str);
return NULL;
}
PyList_SetItem(obData,