[2.7] bpo-36291: Fix a possible reference leak in the json module (GH… · python/cpython@fb3336a

Original file line numberDiff line numberDiff line change

@@ -1375,8 +1375,10 @@ _match_number_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssiz

13751375

else {

13761376

double d = PyOS_string_to_double(PyString_AS_STRING(numstr),

13771377

NULL, NULL);

1378-

if (d == -1.0 && PyErr_Occurred())

1378+

if (d == -1.0 && PyErr_Occurred()) {

1379+

Py_DECREF(numstr);

13791380

return NULL;

1381+

}

13801382

rval = PyFloat_FromDouble(d);

13811383

}

13821384

}