r83239 - in python/branches/py3k: Misc/NEWS Modules/_struct.c
Author: mark.dickinson Date: Thu Jul 29 23:41:59 2010 New Revision: 83239 Log: Issue #9422: Fix memory leak when re-initializing a struct.Struct object. Modified: python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/_struct.c Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jul 29 23:41:59 2010 @@ -1492,6 +1492,8 @@ Extension Modules ----------------- +- Issue #9422: Fix memory leak when re-initializing a struct.Struct object. + - Issue #7900: The getgroups(2) system call on MacOSX behaves rather oddly compared to other unix systems. In particular, os.getgroups() does not reflect any changes made using os.setgroups() but basicly always Modified: python/branches/py3k/Modules/_struct.c ============================================================================== --- python/branches/py3k/Modules/_struct.c (original) +++ python/branches/py3k/Modules/_struct.c Thu Jul 29 23:41:59 2010 @@ -1247,6 +1247,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;
participants (1)
-
mark.dickinson