1. memory leak: ob_refcnt of '*r.68' is 1 too high

    Report

    1
    static PyObject *
    _mysql_ResultObject_fetch_row(
    _mysql_ResultObject *self,
    PyObject *args,
    PyObject *kwargs)
    {
    typedef PyObject *_PYFUNC(_mysql_ResultObject *, MYSQL_ROW);
    static char *kwlist[] = { "maxrows", "how", NULL };
    static _PYFUNC *row_converters[] =
    {
    _mysql_row_to_tuple,
    _mysql_row_to_dict,
    _mysql_row_to_dict_old
    };
    _PYFUNC *convert_row;
    unsigned int maxrows=1, how=0, skiprows=0, rowsadded;
    PyObject *r=NULL;
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii:fetch_row", kwlist,
    &maxrows, &how))
    return NULL;
    check_result_connection(self);
    if (how < 0 || how >= sizeof(row_converters)) {
    PyErr_SetString(PyExc_ValueError, "how out of range");
    return NULL;
    }
    convert_row = row_converters[how];
    if (maxrows) {
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, skiprows, maxrows,
    convert_row);
    if (rowsadded == -1) goto error;
    } else {
    if (self->use) {
    maxrows = 1000;
    if (!(r = PyTuple_New(maxrows))) goto error;
    while (1) {
    rowsadded = _mysql__fetch_row(self, &r, skiprows,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    skiprows += rowsadded;
    if (rowsadded < maxrows) break;
    if (MyTuple_Resize(&r, skiprows+maxrows, 0) == -1)
    goto error;
    }
    } else {
    /* XXX if overflow, maxrows<0? */
    maxrows = (int) mysql_num_rows(self->result);
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, 0,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    }
    }
    return r;
    error:
    Py_XDECREF(r);
    return NULL;
    }
    1. was expecting final owned ob_refcnt of '*r.68' to be 0 since nothing references it but final ob_refcnt is refs: 1 owned

      found 3 similar trace(s) to this

    2. when PyArg_ParseTupleAndKeywords() succeeds

      taking False path

    3. when treating unknown struct PyObject * from _mysql.c:1557 as non-NULL

      when considering range: -0x80000000 <= value <= -1

      taking False path

    4. when considering range: -0x80000000 <= value <= 23

      taking False path

    5. when considering range: -0x80000000 <= value <= -1

      taking True path

    6. when PyTuple_New() succeeds

      taking False path

      '*r.68' was allocated at: if (!(r = PyTuple_New(maxrows))) goto error;

    7. taking False path

  2. memory leak: ob_refcnt of '*r.72' is 1 too high

    Report

    2
    static PyObject *
    _mysql_ResultObject_fetch_row(
    _mysql_ResultObject *self,
    PyObject *args,
    PyObject *kwargs)
    {
    typedef PyObject *_PYFUNC(_mysql_ResultObject *, MYSQL_ROW);
    static char *kwlist[] = { "maxrows", "how", NULL };
    static _PYFUNC *row_converters[] =
    {
    _mysql_row_to_tuple,
    _mysql_row_to_dict,
    _mysql_row_to_dict_old
    };
    _PYFUNC *convert_row;
    unsigned int maxrows=1, how=0, skiprows=0, rowsadded;
    PyObject *r=NULL;
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii:fetch_row", kwlist,
    &maxrows, &how))
    return NULL;
    check_result_connection(self);
    if (how < 0 || how >= sizeof(row_converters)) {
    PyErr_SetString(PyExc_ValueError, "how out of range");
    return NULL;
    }
    convert_row = row_converters[how];
    if (maxrows) {
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, skiprows, maxrows,
    convert_row);
    if (rowsadded == -1) goto error;
    } else {
    if (self->use) {
    maxrows = 1000;
    if (!(r = PyTuple_New(maxrows))) goto error;
    while (1) {
    rowsadded = _mysql__fetch_row(self, &r, skiprows,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    skiprows += rowsadded;
    if (rowsadded < maxrows) break;
    if (MyTuple_Resize(&r, skiprows+maxrows, 0) == -1)
    goto error;
    }
    } else {
    /* XXX if overflow, maxrows<0? */
    maxrows = (int) mysql_num_rows(self->result);
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, 0,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    }
    }
    return r;
    error:
    Py_XDECREF(r);
    return NULL;
    }
    1. was expecting final owned ob_refcnt of '*r.72' to be 0 since nothing references it but final ob_refcnt is refs: 1 owned

      found 19 similar trace(s) to this

    2. when PyArg_ParseTupleAndKeywords() succeeds

      taking False path

    3. when treating unknown struct PyObject * from _mysql.c:1557 as non-NULL

      when considering range: -0x80000000 <= value <= -1

      taking False path

    4. when considering range: -0x80000000 <= value <= 23

      taking False path

    5. when considering value == (int)0 from _mysql.c:1554

      taking False path

    6. when considering range: -0x80000000 <= value <= -1

      taking True path

    7. when PyTuple_New() succeeds

      taking False path

      '*r.72' was allocated at: if (!(r = PyTuple_New(maxrows))) goto error;

    8. taking False path

    9. when considering range: -0x80000000 <= value <= 999

      taking True path

  3. returning (PyObject*)NULL without setting an exception

    Report

    3
    static PyObject *
    _mysql_ResultObject_fetch_row(
    _mysql_ResultObject *self,
    PyObject *args,
    PyObject *kwargs)
    {
    typedef PyObject *_PYFUNC(_mysql_ResultObject *, MYSQL_ROW);
    static char *kwlist[] = { "maxrows", "how", NULL };
    static _PYFUNC *row_converters[] =
    {
    _mysql_row_to_tuple,
    _mysql_row_to_dict,
    _mysql_row_to_dict_old
    };
    _PYFUNC *convert_row;
    unsigned int maxrows=1, how=0, skiprows=0, rowsadded;
    PyObject *r=NULL;
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii:fetch_row", kwlist,
    &maxrows, &how))
    return NULL;
    check_result_connection(self);
    if (how < 0 || how >= sizeof(row_converters)) {
    PyErr_SetString(PyExc_ValueError, "how out of range");
    return NULL;
    }
    convert_row = row_converters[how];
    if (maxrows) {
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, skiprows, maxrows,
    convert_row);
    if (rowsadded == -1) goto error;
    } else {
    if (self->use) {
    maxrows = 1000;
    if (!(r = PyTuple_New(maxrows))) goto error;
    while (1) {
    rowsadded = _mysql__fetch_row(self, &r, skiprows,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    skiprows += rowsadded;
    if (rowsadded < maxrows) break;
    if (MyTuple_Resize(&r, skiprows+maxrows, 0) == -1)
    goto error;
    }
    } else {
    /* XXX if overflow, maxrows<0? */
    maxrows = (int) mysql_num_rows(self->result);
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, 0,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    }
    }
    return r;
    error:
    Py_XDECREF(r);
    return NULL;
    }
    1. found 15 similar trace(s) to this

    2. when PyArg_ParseTupleAndKeywords() succeeds

      taking False path

    3. when treating unknown struct PyObject * from _mysql.c:1557 as non-NULL

      when considering range: -0x80000000 <= value <= -1

      taking False path

    4. when considering range: -0x80000000 <= value <= 23

      taking False path

    5. when considering value == (int)0 from _mysql.c:1554

      taking False path

    6. when considering range: -0x80000000 <= value <= -1

      taking True path

    7. when PyTuple_New() succeeds

      taking False path

    8. taking False path

    9. when considering range: 1000 <= value <= 0x7fffffff

      taking False path

    10. when considering value == (int)-1 from _mysql.c:1578

      taking True path

    11. when treating unknown struct PyObject * * from _mysql.c:1578 as non-NULL

      taking False path

      when considering range: -0x8000000000000000 <= value <= -1

      taking True path

  4. memory leak: ob_refcnt of '*r.74' is 1 too high

    Report

    4
    static PyObject *
    _mysql_ResultObject_fetch_row(
    _mysql_ResultObject *self,
    PyObject *args,
    PyObject *kwargs)
    {
    typedef PyObject *_PYFUNC(_mysql_ResultObject *, MYSQL_ROW);
    static char *kwlist[] = { "maxrows", "how", NULL };
    static _PYFUNC *row_converters[] =
    {
    _mysql_row_to_tuple,
    _mysql_row_to_dict,
    _mysql_row_to_dict_old
    };
    _PYFUNC *convert_row;
    unsigned int maxrows=1, how=0, skiprows=0, rowsadded;
    PyObject *r=NULL;
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii:fetch_row", kwlist,
    &maxrows, &how))
    return NULL;
    check_result_connection(self);
    if (how < 0 || how >= sizeof(row_converters)) {
    PyErr_SetString(PyExc_ValueError, "how out of range");
    return NULL;
    }
    convert_row = row_converters[how];
    if (maxrows) {
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, skiprows, maxrows,
    convert_row);
    if (rowsadded == -1) goto error;
    } else {
    if (self->use) {
    maxrows = 1000;
    if (!(r = PyTuple_New(maxrows))) goto error;
    while (1) {
    rowsadded = _mysql__fetch_row(self, &r, skiprows,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    skiprows += rowsadded;
    if (rowsadded < maxrows) break;
    if (MyTuple_Resize(&r, skiprows+maxrows, 0) == -1)
    goto error;
    }
    } else {
    /* XXX if overflow, maxrows<0? */
    maxrows = (int) mysql_num_rows(self->result);
    if (!(r = PyTuple_New(maxrows))) goto error;
    rowsadded = _mysql__fetch_row(self, &r, 0,
    maxrows, convert_row);
    if (rowsadded == -1) goto error;
    }
    }
    return r;
    error:
    Py_XDECREF(r);
    return NULL;
    }
    1. was expecting final owned ob_refcnt of '*r.74' to be 0 since nothing references it but final ob_refcnt is refs: 1 owned

      found 1 similar trace(s) to this

    2. when PyArg_ParseTupleAndKeywords() succeeds

      taking False path

    3. when treating unknown struct PyObject * from _mysql.c:1557 as non-NULL

      when considering range: -0x80000000 <= value <= -1

      taking False path

    4. when considering range: -0x80000000 <= value <= 23

      taking False path

    5. when considering value == (int)0 from _mysql.c:1554

      taking False path

    6. when considering value == (int)0 from _mysql.c:1569

      taking False path

    7. when PyTuple_New() succeeds

      taking False path

      '*r.74' was allocated at: if (!(r = PyTuple_New(maxrows))) goto error;

    8. taking False path