diff Python/thread.c @ 84490:18bb92b0c458

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()
author Victor Stinner <victor.stinner@gmail.com>
date Sun, 07 Jul 2013 16:25:15 +0200
parents ffc6e6b00949
children fc718c177ee6
line wrap: on
line diff
--- a/Python/thread.c	Sun Jul 07 15:50:49 2013 +0200
+++ b/Python/thread.c	Sun Jul 07 16:25:15 2013 +0200
@@ -231,7 +231,7 @@
         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 @@
     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 @@
     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 @@
     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