1. memory leak: ob_refcnt of new ref from (unknown) _mysql_Exception is 1 too high

    Report

    1
    static PyObject *_mysql_thread_safe(
    PyObject *self,
    PyObject *args) {
    PyObject *flag;
    if (!PyArg_ParseTuple(args, "")) return NULL;
    check_server_init(NULL);
    if (!(flag=PyInt_FromLong((long)mysql_thread_safe()))) return NULL;
    return flag;
    }
    #endif
    1. when PyArg_ParseTuple() succeeds

      taking False path

    2. when considering value == (int)0 from _mysql.c:121

      taking True path

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

      taking True path

      when _mysql_Exception() succeeds

      new ref from (unknown) _mysql_Exception was allocated at: check_server_init(NULL);

      was expecting final owned ob_refcnt of new ref from (unknown) _mysql_Exception to be 0 since nothing references it but final ob_refcnt is refs: 1 owned

      found 1 similar trace(s) to this

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

    Report

    2
    static PyObject *_mysql_thread_safe(
    PyObject *self,
    PyObject *args) {
    PyObject *flag;
    if (!PyArg_ParseTuple(args, "")) return NULL;
    check_server_init(NULL);
    if (!(flag=PyInt_FromLong((long)mysql_thread_safe()))) return NULL;
    return flag;
    }
    #endif
    1. when PyArg_ParseTuple() succeeds

      taking False path

    2. when considering value == (int)0 from _mysql.c:121

      taking True path

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

      taking True path

      when _mysql_Exception() succeeds

      found 1 similar trace(s) to this