summaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2014-03-13 17:38:20 +0100
committerJesus Cea <jcea@jcea.es>2014-03-13 17:38:20 +0100
commitc82025343fff9c4d8c9e164974b6198df523899d (patch)
tree2030bd29bf51005c81d0a82cd026509a4c5a82f2 /PC
parent3e0ea0f00f958b054e04243abc6cbf0ea327466c (diff)
parent75b489146a5138fcb0629be52ef1a098ee1cdd61 (diff)
downloadcpython-c82025343fff9c4d8c9e164974b6198df523899d.tar.gz
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 563a3ebcf5..7671317726 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,