mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Closes #20908: Memory leak in Reg2Py()
This commit is contained in:
parent
45fc8713bd
commit
782c4cf155
1 changed files with 4 additions and 1 deletions
|
@ -943,8 +943,10 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
|
||||||
|
|
||||||
fixupMultiSZ(str, data, len);
|
fixupMultiSZ(str, data, len);
|
||||||
obData = PyList_New(s);
|
obData = PyList_New(s);
|
||||||
if (obData == NULL)
|
if (obData == NULL) {
|
||||||
|
free(str);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
for (index = 0; index < s; index++)
|
for (index = 0; index < s; index++)
|
||||||
{
|
{
|
||||||
size_t len = wcslen(str[index]);
|
size_t len = wcslen(str[index]);
|
||||||
|
@ -952,6 +954,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
|
||||||
PyErr_SetString(PyExc_OverflowError,
|
PyErr_SetString(PyExc_OverflowError,
|
||||||
"registry string is too long for a Python string");
|
"registry string is too long for a Python string");
|
||||||
Py_DECREF(obData);
|
Py_DECREF(obData);
|
||||||
|
free(str);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
PyList_SetItem(obData,
|
PyList_SetItem(obData,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue