Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules

Replace malloc() with PyMem_Malloc() when the GIL is held, or with
PyMem_RawMalloc() otherwise.
This commit is contained in:
Victor Stinner 2013-07-07 16:21:41 +02:00
parent 1a7425f67a
commit b64049183c
10 changed files with 52 additions and 55 deletions

View file

@ -3406,7 +3406,7 @@ PyInit__curses(void)
continue;
if (strncmp(key_n,"KEY_F(",6)==0) {
char *p1, *p2;
key_n2 = malloc(strlen(key_n)+1);
key_n2 = PyMem_Malloc(strlen(key_n)+1);
if (!key_n2) {
PyErr_NoMemory();
break;
@ -3425,7 +3425,7 @@ PyInit__curses(void)
key_n2 = key_n;
SetDictInt(key_n2,key);
if (key_n2 != key_n)
free(key_n2);
PyMem_Free(key_n2);
}
#endif
SetDictInt("KEY_MIN", KEY_MIN);