8000 Merge branch 'master' of github.com:msgpack/msgpack-python · ooici/msgpack-python@91a1abb · GitHub
[go: up one dir, main page]

Skip to content

Commit 91a1abb

Browse files
committed
Merge branch 'master' of github.com:msgpack/msgpack-python
2 parents 64bdf6b + 02f01f6 commit 91a1abb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

msgpack/unpack.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ static inline int template_callback_array_end(unpack_user* u, msgpack_unpack_obj
161161
{
162162
if (u->list_hook) {
163163
PyObject *arglist = Py_BuildValue("(O)", *c);
164-
*c = PyEval_CallObject(u->list_hook, arglist);
164+
PyObject *new_c = PyEval_CallObject(u->list_hook, arglist);
165165
Py_DECREF(arglist);
166+
Py_DECREF(*c);
167+
*c = new_c;
166168
}
167169
return 0;
168170
}
@@ -190,8 +192,10 @@ static inline int template_callback_map_end(unpack_user* u, msgpack_unpack_objec
190192
{
191193
if (u->object_hook) {
192194
PyObject *arglist = Py_BuildValue("(O)", *c);
193-
*c = PyEval_CallObject(u->object_hook, arglist);
195+
PyObject *new_c = PyEval_CallObject(u->object_hook, arglist);
194196
Py_DECREF(arglist);
197+
Py_DECREF(*c);
198+
*c = new_c;
195199
}
196200
return 0;
197201
}

0 commit comments

Comments
 (0)
0