diff options
author | Jesus Cea <jcea@jcea.es> | 2014-03-13 17:38:20 +0100 |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2014-03-13 17:38:20 +0100 |
commit | c82025343fff9c4d8c9e164974b6198df523899d (patch) | |
tree | 2030bd29bf51005c81d0a82cd026509a4c5a82f2 /PC | |
parent | 3e0ea0f00f958b054e04243abc6cbf0ea327466c (diff) | |
parent | 75b489146a5138fcb0629be52ef1a098ee1cdd61 (diff) | |
download | cpython-c82025343fff9c4d8c9e164974b6198df523899d.tar.gz |
MERGE: Closes #20908: Memory leak in Reg2Py()
Diffstat (limited to 'PC')
-rw-r--r-- | PC/winreg.c | 5 |
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, |