[Python-checkins] cpython (3.3): Issue #16215: Fix potential double memory free in str.replace().
antoine.pitrou
python-checkins at python.org
Sat Nov 17 23:30:52 CET 2012
http://hg.python.org/cpython/rev/26e5234239ae
changeset: 80480:26e5234239ae
branch: 3.3
parent: 80474:d6cd283bb4c2
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat Nov 17 23:28:17 2012 +0100
summary:
Issue #16215: Fix potential double memory free in str.replace().
Patch by Serhiy Storchaka.
files:
Misc/NEWS | 3 +++
Objects/unicodeobject.c | 2 ++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@
Core and Builtins
-----------------
+- Issue #16215: Fix potential double memory free in str.replace(). Patch
+ by Serhiy Storchaka.
+
- Issue #16453: Fix equality testing of dead weakref objects.
- Issue #9535: Fix pending signals that have been received but not yet
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10118,6 +10118,7 @@
/* widen self and buf1 */
rkind = kind2;
if (release1) PyMem_Free(buf1);
+ release1 = 0;
sbuf = _PyUnicode_AsKind(self, rkind);
if (!sbuf) goto error;
srelease = 1;
@@ -10179,6 +10180,7 @@
if (!sbuf) goto error;
srelease = 1;
if (release1) PyMem_Free(buf1);
+ release1 = 0;
buf1 = _PyUnicode_AsKind(str1, rkind);
if (!buf1) goto error;
release1 = 1;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list