summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
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 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;