On Fri, 12 Mar 2004 17:27:12 +0100
"Dittmar, Daniel" <[EMAIL PROTECTED]> wrote:

> 
> I've updated the python modules:
> Linux: ftp://ftp.sap.com/pub/sapdb/bin/linux/sapdb-python-linux-i386-7.4.03.33a.tgz
> Win32: ftp://ftp.sap.com/pub/sapdb/bin/win/sapdb-python-win32-7.4.03.33a.zip
> and the other platforms from http://www.sapdb.org/7.4/sap_db_downloads.htm
> 
> Daniel Dittmar

Found another bad Leak:
I am not really sure if the lines I added are really correct.....
but there is no leak with the testscripts below.....


vin77.c: (see: "/*<<<<was missing*/")



static void
raiseSQLError (
    int code,
    int pos,
    tsp00_C5  sqlStateStr,
    const char * msg)
{
    ROUTINE_DBG_MSP00 ("raiseSQLError");
    PyObject * exception = PyInstance_New (SQLErrorType, NULL, NULL);
    PyObject * errorCode = NULL;
    PyObject * message = NULL;
    PyObject * errorPos = NULL;
    PyObject * sqlState = NULL;

    errorCode = PyInt_FromLong  (code);
    message = PyString_FromString  (msg);
    errorPos = PyInt_FromLong  (pos);
    sqlState = PyString_FromStringAndSize  ((char *)sqlStateStr, sizeof (sqlState));
    if (exception != NULL) {
        PyObject_SetAttrString (exception, LIT("errorCode"), errorCode) ;
        PyObject_SetAttrString (exception, LIT("message"), message);
        PyObject_SetAttrString (exception, LIT("errorPos"), errorPos);
        PyObject_SetAttrString (exception, LIT("sqlState"), sqlState);
    }
    else {
        exception = Py_BuildValue (LIT("NNNN"), errorCode, message,
            errorPos, sqlState);
    }
    PyErr_SetObject (SQLErrorType, exception);
    /*patch*/
    Py_DECREF(errorCode);           /*<<<<was missing*/
    Py_DECREF(message);             /*<<<<was missing*/
    Py_DECREF(errorPos);            /*<<<<was missing*/
    Py_DECREF(sqlState);            /*<<<<was missing*/
    Py_DECREF(exception);           /*<<<<was missing*/
}


An (I think so) also in :

static void
raiseCommunicationError (
    int code,
    const char * msg)
{
    ROUTINE_DBG_MSP00 ("raiseCommunicationError");
    PyObject * exception = PyInstance_New (CommunicationErrorType, NULL, NULL);
    PyObject * pycode = NULL;
    PyObject * pymsg = NULL;

    pycode = PyInt_FromLong  (code);
    pymsg = PyString_FromString  (msg);
    if (exception != NULL) {
        PyObject_SetAttrString (exception, LIT("errorCode"), pycode) ;
        PyObject_SetAttrString (exception, LIT("message"), pymsg);
        Py_XDECREF (pycode);
        Py_XDECREF (pymsg);
    }
    else {
        exception = Py_BuildValue (LIT("NN"), pycode, pymsg);
    }
    PyErr_SetObject (CommunicationErrorType, exception);
    Py_DECREF(exception);           /*<<<<was missing*/
}





------------------------------------------------------------------------
Testscripts to reproduce:

#SQLError
connection=sapdb.connect("xxx","yyy","zzz")
while 1:
        try:
                rset=connection.sql("xxx") #makes an error
        except Exception,err:
                print "Error!"
        print open("/proc/%i/status" % os.getpid()).read()



#ConnectionError


while 1:
        try:
                connection=sapdb.connect("foo","bar","hans")  #<<<invalid connecturl
        except Exception,err:
                print "Error!"
        print open("/proc/%i/status" % os.getpid()).read()
                






> 
> -- 
> Daniel Dittmar
> SAP Labs Berlin
> [EMAIL PROTECTED]


-- 
__________________________________________________________________________

Als Technologieunternehmen konzipieren und entwickeln wir ma�geschneiderte Feedback- 
und
Monitoring-Systeme - wie beispielsweise L�sungen f�r Beschwerde- und Ideenmanagement.
Mit dem Inquery� Survey Server bieten wir eine der leistungsf�higsten Standardl�sungen 
f�r
Online-Umfragen mit dem Schwerpunkt auf der Messung von Kundenzufriedenheit an.
__________________________________________________________________________


Inworks GmbH
Andre Reitz, Leiter Entwicklung
H�rvelsinger Weg 39, 89081 Ulm, Germany
Tel +49 (0) 731 / 93807-21
Fax +49(0)731/93807-18
Internet: http://www.inworks.de



--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to