[Python-checkins] r58120 - python/branches/release25-maint/Mac/Modules/cf/_CFmodule.c python/branches/release25-maint/Mac/Modules/cf/cfsupport.py python/branches/release25-maint/Mac/Modules/cf/pycfbridge.c
georg.brandl
python-checkins at python.org
Wed Sep 12 20:29:21 CEST 2007
Author: georg.brandl
Date: Wed Sep 12 20:29:21 2007
New Revision: 58120
Modified:
python/branches/release25-maint/Mac/Modules/cf/_CFmodule.c
python/branches/release25-maint/Mac/Modules/cf/cfsupport.py
python/branches/release25-maint/Mac/Modules/cf/pycfbridge.c
Log:
bug #1154: release memory allocated by "es" PyArg_ParseTuple format specifier.
(backport from rev. 58119)
Modified: python/branches/release25-maint/Mac/Modules/cf/_CFmodule.c
==============================================================================
--- python/branches/release25-maint/Mac/Modules/cf/_CFmodule.c (original)
+++ python/branches/release25-maint/Mac/Modules/cf/_CFmodule.c Wed Sep 12 20:29:21 2007
@@ -1828,6 +1828,7 @@
if (!PyArg_Parse(v, "es", "ascii", &cStr))
return 0;
*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
+ PyMem_Free(cStr);
return 1;
}
if (PyUnicode_Check(v)) {
Modified: python/branches/release25-maint/Mac/Modules/cf/cfsupport.py
==============================================================================
--- python/branches/release25-maint/Mac/Modules/cf/cfsupport.py (original)
+++ python/branches/release25-maint/Mac/Modules/cf/cfsupport.py Wed Sep 12 20:29:21 2007
@@ -429,6 +429,7 @@
if (!PyArg_Parse(v, "es", "ascii", &cStr))
return NULL;
*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
+ PyMem_Free(cStr);
return 1;
}
if (PyUnicode_Check(v)) {
Modified: python/branches/release25-maint/Mac/Modules/cf/pycfbridge.c
==============================================================================
--- python/branches/release25-maint/Mac/Modules/cf/pycfbridge.c (original)
+++ python/branches/release25-maint/Mac/Modules/cf/pycfbridge.c Wed Sep 12 20:29:21 2007
@@ -285,6 +285,7 @@
if (!PyArg_Parse(src, "es", "ascii", &chars))
return 0; /* This error is more descriptive than the general one below */
*dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII);
+ PyMem_Free(chars);
return 1;
}
if (PyUnicode_Check(src)) {
More information about the Python-checkins
mailing list