summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-29 21:47:28 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-29 21:47:28 (GMT)
commitf417ae8d4c9bb497868124098aeb2c260dd1964c (patch)
tree37720c901030e99b31d8a22f9fcd91475bbff521 /Modules
parent8243ddb6ca5c0f78764a28f044f0c0284774d317 (diff)
downloadcpython-f417ae8d4c9bb497868124098aeb2c260dd1964c.zip
cpython-f417ae8d4c9bb497868124098aeb2c260dd1964c.tar.gz
cpython-f417ae8d4c9bb497868124098aeb2c260dd1964c.tar.bz2
Merged revisions 83241 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint ................ r83241 | mark.dickinson | 2010-07-29 22:44:47 +0100 (Thu, 29 Jul 2010) | 9 lines Merged revisions 83239 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83239 | mark.dickinson | 2010-07-29 22:41:59 +0100 (Thu, 29 Jul 2010) | 2 lines Issue #9422: Fix memory leak when re-initializing a struct.Struct object. ........ ................
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_struct.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 936e8af..b85d106 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1404,6 +1404,9 @@ prepare_s(PyStructObject *self)
PyErr_NoMemory();
return -1;
}
+ /* Free any s_codes value left over from a previous initialization. */
+ if (self->s_codes != NULL)
+ PyMem_FREE(self->s_codes);
self->s_codes = codes;
s = fmt;