summaryrefslogtreecommitdiffstats
path: root/Modules/_json.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-10-16 21:09:28 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-10-16 21:09:28 (GMT)
commit595e3cbb3db46124abcbf605bbe8d5784a69213e (patch)
tree41cd219c268744ce348f24885c3801cbabc86c41 /Modules/_json.c
parenteaede315d1f9e18c6fcad30d3b13f8b2a7242e37 (diff)
downloadcpython-595e3cbb3db46124abcbf605bbe8d5784a69213e.zip
cpython-595e3cbb3db46124abcbf605bbe8d5784a69213e.tar.gz
cpython-595e3cbb3db46124abcbf605bbe8d5784a69213e.tar.bz2
check for error conditions in _json #3623
Diffstat (limited to 'Modules/_json.c')
-rw-r--r--Modules/_json.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 88510a7..832b1ff 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -179,11 +179,13 @@ raise_errmsg(char *msg, PyObject *s, Py_ssize_t end)
errmsg_fn = PyObject_GetAttrString(decoder, "errmsg");
if (errmsg_fn == NULL)
return;
- Py_XDECREF(decoder);
+ Py_DECREF(decoder);
}
pymsg = PyObject_CallFunction(errmsg_fn, "(zOn)", msg, s, end);
- PyErr_SetObject(PyExc_ValueError, pymsg);
- Py_DECREF(pymsg);
+ if (pymsg) {
+ PyErr_SetObject(PyExc_ValueError, pymsg);
+ Py_DECREF(pymsg);
+ }
/*
def linecol(doc, pos):