[Python-checkins] cpython: Issue #18203: Replace PyMem_Malloc() with PyMem_RawMalloc() at Python

victor.stinner python-checkins at python.org
Sat Jul 27 02:39:50 CEST 2013


http://hg.python.org/cpython/rev/1cba6687993e
changeset:   84859:1cba6687993e
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Jul 27 01:13:34 2013 +0200
summary:
  Issue #18203: Replace PyMem_Malloc() with PyMem_RawMalloc() at Python initialization

files:
  Python/frozenmain.c |  12 ++++++------
  1 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/Python/frozenmain.c b/Python/frozenmain.c
--- a/Python/frozenmain.c
+++ b/Python/frozenmain.c
@@ -24,8 +24,8 @@
     /* We need a second copies, as Python might modify the first one. */
     wchar_t **argv_copy2;
 
-    argv_copy = PyMem_Malloc(sizeof(wchar_t*)*argc);
-    argv_copy2 = PyMem_Malloc(sizeof(wchar_t*)*argc);
+    argv_copy = PyMem_RawMalloc(sizeof(wchar_t*)*argc);
+    argv_copy2 = PyMem_RawMalloc(sizeof(wchar_t*)*argc);
     if (!argv_copy || !argv_copy2) {
         fprintf(stderr, "out of memory\n");
         return 1;
@@ -62,7 +62,7 @@
             fprintf(stderr, "Could not convert argument %d to string\n", i);
             return 1;
         }
-        argv_copy[i] = PyMem_Malloc((argsize+1)*sizeof(wchar_t));
+        argv_copy[i] = PyMem_RawMalloc((argsize+1)*sizeof(wchar_t));
         argv_copy2[i] = argv_copy[i];
         if (!argv_copy[i]) {
             fprintf(stderr, "out of memory\n");
@@ -109,9 +109,9 @@
 #endif
     Py_Finalize();
     for (i = 0; i < argc; i++) {
-        PyMem_Free(argv_copy2[i]);
+        PyMem_RawFree(argv_copy2[i]);
     }
-    PyMem_Free(argv_copy);
-    PyMem_Free(argv_copy2);
+    PyMem_RawFree(argv_copy);
+    PyMem_RawFree(argv_copy2);
     return sts;
 }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list