diff options
-rw-r--r-- | msgpack/unpack.h | 3 | ||||
-rw-r--r-- | msgpack/unpack_template.h | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/msgpack/unpack.h b/msgpack/unpack.h index 5ec7dbc..61e5d91 100644 --- a/msgpack/unpack.h +++ b/msgpack/unpack.h @@ -207,6 +207,9 @@ static inline int template_callback_map_end(unpack_user* u, msgpack_unpack_objec { if (u->object_hook) { PyObject *new_c = PyEval_CallFunction(u->object_hook, "(O)", *c); + if (!new_c) + return -1; + Py_DECREF(*c); *c = new_c; } diff --git a/msgpack/unpack_template.h b/msgpack/unpack_template.h index 7d07601..9d13062 100644 --- a/msgpack/unpack_template.h +++ b/msgpack/unpack_template.h @@ -361,7 +361,7 @@ _push: if(construct_cb(_map_item)(user, c->count, &c->obj, c->map_key, obj) < 0) { goto _failed; } if(++c->count == c->size) { obj = c->obj; - construct_cb(_map_end)(user, &obj); + if (construct_cb(_map_end)(user, &obj) < 0) { goto _failed; } --top; /*printf("stack pop %d\n", top);*/ goto _push; |