Skip to content
Snippets Groups Projects
Commit 2bc5d1531235 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

revlog: fix excessive decref on tuple creation failure in parse_index2()

Since Py_BuildValue() steals the ownership of "N" arguments, these objects
would already be freed if Py_BuildValue() returned NULL.

https://github.com/python/cpython/blob/2.7/Python/modsupport.c#L292
parent 04c428e93770
No related branches found
No related tags found
No related merge requests found
......@@ -2885,7 +2885,7 @@
*/
PyObject *parse_index2(PyObject *self, PyObject *args)
{
PyObject *tuple = NULL, *cache = NULL;
PyObject *cache = NULL;
indexObject *idx;
int ret;
......@@ -2906,11 +2906,8 @@
Py_INCREF(cache);
}
tuple = Py_BuildValue("NN", idx, cache);
if (!tuple)
goto bail;
return tuple;
return Py_BuildValue("NN", idx, cache);
bail:
Py_XDECREF(idx);
Py_XDECREF(cache);
......@@ -2913,8 +2910,7 @@
bail:
Py_XDECREF(idx);
Py_XDECREF(cache);
Py_XDECREF(tuple);
return NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment