From 79e44f86c9ec554f56b9807f909e21887c36d166 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Sat, 22 Dec 2012 12:14:05 +0900 Subject: [PATCH] Add NULL check. --- msgpack/unpack.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/msgpack/unpack.h b/msgpack/unpack.h index 7064a1b..0851ec2 100644 --- a/msgpack/unpack.h +++ b/msgpack/unpack.h @@ -206,6 +206,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 == NULL) { + return -1; + } Py_DECREF(*c); *c = new_c; }