Commit 8f606a0d authored by Jesus Cea's avatar Jesus Cea

Closes #20908: Memory leak in Reg2Py()

parent 4c874ef4
...@@ -948,8 +948,10 @@ Reg2Py(char *retDataBuf, DWORD retDataSize, DWORD typ) ...@@ -948,8 +948,10 @@ Reg2Py(char *retDataBuf, DWORD retDataSize, DWORD typ)
fixupMultiSZ(str, retDataBuf, retDataSize); fixupMultiSZ(str, retDataBuf, retDataSize);
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 = _mbstrlen(str[index]); size_t len = _mbstrlen(str[index]);
...@@ -957,6 +959,7 @@ Reg2Py(char *retDataBuf, DWORD retDataSize, DWORD typ) ...@@ -957,6 +959,7 @@ Reg2Py(char *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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment