Skip to content

Commit

Permalink
Issue python#20908: PyMem_Malloc() must be used with PyMem_Free(), no…
Browse files Browse the repository at this point in the history
…t with free()
  • Loading branch information
vstinner committed Mar 13, 2014
1 parent 58c767f commit 9cb1ec5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PC/winreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
fixupMultiSZ(str, data, len);
obData = PyList_New(s);
if (obData == NULL) {
free(str);
PyMem_Free(str);
return NULL;
}
for (index = 0; index < s; index++)
Expand All @@ -954,7 +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);
PyMem_Free(str);
return NULL;
}
PyList_SetItem(obData,
Expand Down

0 comments on commit 9cb1ec5

Please sign in to comment.