Issue #9422: Fix memory leak when re-initializing a struct.Struct object.

This commit is contained in:
Mark Dickinson 2010-07-29 21:41:59 +00:00
parent 0a0fc07d37
commit cf28b95800
2 changed files with 5 additions and 0 deletions

View file

@ -1247,6 +1247,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;