Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9cb1ec5

Browse files
committed
Issue #20908: PyMem_Malloc() must be used with PyMem_Free(), not with free()
1 parent 58c767f commit 9cb1ec5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

PC/winreg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
944944
fixupMultiSZ(str, data, len);
945945
obData = PyList_New(s);
946946
if (obData == NULL) {
947-
free(str);
947+
PyMem_Free(str);
948948
return NULL;
949949
}
950950
for (index = 0; index < s; index++)
@@ -954,7 +954,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
954954
PyErr_SetString(PyExc_OverflowError,
955955
"registry string is too long for a Python string");
956956
Py_DECREF(obData);
957-
free(str);
957+
PyMem_Free(str);
958958
return NULL;
959959
}
960960
PyList_SetItem(obData,

0 commit comments

Comments
 (0)