Mercurial > cpython-lru_cache-weakref
diff Modules/_struct.c @ 63300:b75ca25a140b 2.7
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.
........
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Thu, 29 Jul 2010 21:44:47 +0000 |
| parents | 19191559ec02 |
| children | b36cb4602e21 |
line wrap: on
line diff
--- a/Modules/_struct.c Thu Jul 29 13:18:19 2010 +0000 +++ b/Modules/_struct.c Thu Jul 29 21:44:47 2010 +0000 @@ -1289,6 +1289,9 @@ 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;
