diff options
author | Jesus Cea <jcea@jcea.es> | 2014-03-13 16:35:32 (GMT) |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2014-03-13 16:35:32 (GMT) |
commit | 782c4cf1553e46fdfbabc4bf627721a5df32ca55 (patch) | |
tree | e04cb1047da8955b0ef3e54027d62bee65dd6fdf /PC | |
parent | 45fc8713bda1bfd6c0de3c6f493a4eeff52acbe3 (diff) | |
download | cpython-782c4cf1553e46fdfbabc4bf627721a5df32ca55.zip cpython-782c4cf1553e46fdfbabc4bf627721a5df32ca55.tar.gz cpython-782c4cf1553e46fdfbabc4bf627721a5df32ca55.tar.bz2 |
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 3b9693c..3347eb7 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, |