[Python-checkins] cpython: Issue #20908: PyMem_Malloc() must be used with PyMem_Free(), not with free()

victor.stinner python-checkins at python.org
Thu Mar 13 19:09:11 CET 2014


http://hg.python.org/cpython/rev/6e3e91662216
changeset:   89639:6e3e91662216
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Mar 13 19:08:10 2014 +0100
summary:
  Issue #20908: PyMem_Malloc() must be used with PyMem_Free(), not with free()

files:
  PC/winreg.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/PC/winreg.c b/PC/winreg.c
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -944,7 +944,7 @@
                 fixupMultiSZ(str, data, len);
                 obData = PyList_New(s);
                 if (obData == NULL) {
-                    free(str);
+                    PyMem_Free(str);
                     return NULL;
                 }
                 for (index = 0; index < s; index++)
@@ -954,7 +954,7 @@
                         PyErr_SetString(PyExc_OverflowError,
                             "registry string is too long for a Python string");
                         Py_DECREF(obData);
-                        free(str);
+                        PyMem_Free(str);
                         return NULL;
                     }
                     PyList_SetItem(obData,

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


More information about the Python-checkins mailing list