diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-07-29 21:43:24 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-07-29 21:43:24 (GMT) |
commit | 2da63cc338a0356a59ce42cad9af8e1e368c9fbf (patch) | |
tree | 2033ee8fe22c1cfb0dfe96320a1fa5a6d69950ce /Modules/_struct.c | |
parent | 8a550f3149662b0a5eb448afd659c95afe42cd0b (diff) | |
download | cpython-2da63cc338a0356a59ce42cad9af8e1e368c9fbf.zip cpython-2da63cc338a0356a59ce42cad9af8e1e368c9fbf.tar.gz cpython-2da63cc338a0356a59ce42cad9af8e1e368c9fbf.tar.bz2 |
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/_struct.c')
-rw-r--r-- | Modules/_struct.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index c1db286..74d846a 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1233,6 +1233,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; |