We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0d600a3 commit 9f24141Copy full SHA for 9f24141
2 files changed
msgpack/_unpacker.pyx
@@ -322,6 +322,7 @@ cdef class Unpacker:
322
self.buf = NULL
323
324
def __dealloc__(self):
325
+ unpack_clear(&self.ctx)
326
PyMem_Free(self.buf)
327
328
msgpack/unpack_template.h
@@ -72,6 +72,14 @@ static inline PyObject* unpack_data(unpack_context* ctx)
72
73
static inline void unpack_clear(unpack_context *ctx)
74
{
75
+ unsigned int i;
76
+ for (i = 0; i < ctx->top; i++) {
77
+ Py_CLEAR(ctx->stack[i].obj);
78
+ /* map_key holds a live reference only while waiting for the value */
79
+ if (ctx->stack[i].ct == CT_MAP_VALUE) {
80
+ Py_CLEAR(ctx->stack[i].map_key);
81
+ }
82
83
Py_CLEAR(ctx->stack[0].obj);
84
}
85
0 commit comments