summaryrefslogtreecommitdiff
path: root/Python/thread.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-07 16:25:15 +0200
committerVictor Stinner <victor.stinner@gmail.com>2013-07-07 16:25:15 +0200
commit1a7425f67a0d141483d89ca80ca01e3cb7f6be92 (patch)
treec5c3db81a3f0b754d3c7d2cfafd8609cba58142a /Python/thread.c
parent51fa458d0a8fa6e9f583fc5a1c4164080093e763 (diff)
downloadcpython-git-1a7425f67a0d141483d89ca80ca01e3cb7f6be92.tar.gz
Issue #18203: Replace malloc() with PyMem_RawMalloc() at Python initialization
* Replace malloc() with PyMem_RawMalloc() * Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held. * _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead of PyMem_Malloc()
Diffstat (limited to 'Python/thread.c')
-rw-r--r--Python/thread.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/thread.c b/Python/thread.c
index 25ab16e647..54ce875eb2 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -231,7 +231,7 @@ find_key(int key, void *value)
assert(p == NULL);
goto Done;
}
- p = (struct key *)malloc(sizeof(struct key));
+ p = (struct key *)PyMem_RawMalloc(sizeof(struct key));
if (p != NULL) {
p->id = id;
p->key = key;
@@ -270,7 +270,7 @@ PyThread_delete_key(int key)
while ((p = *q) != NULL) {
if (p->key == key) {
*q = p->next;
- free((void *)p);
+ PyMem_RawFree((void *)p);
/* NB This does *not* free p->value! */
}
else
@@ -324,7 +324,7 @@ PyThread_delete_key_value(int key)
while ((p = *q) != NULL) {
if (p->key == key && p->id == id) {
*q = p->next;
- free((void *)p);
+ PyMem_RawFree((void *)p);
/* NB This does *not* free p->value! */
break;
}
@@ -357,7 +357,7 @@ PyThread_ReInitTLS(void)
while ((p = *q) != NULL) {
if (p->id != id) {
*q = p->next;
- free((void *)p);
+ PyMem_RawFree((void *)p);
/* NB This does *not* free p->value! */
}
else