odbc driver leaks memory when connection failed - Mailing list pgsql-odbc

From shoji.morimoto@soliton.co.jp
Subject odbc driver leaks memory when connection failed
Date
Msg-id 4B03517A.5060302@soliton.co.jp
Whole thread Raw
Responses Re: odbc driver leaks memory when connection failed  (Hiroshi Inoue <inoue@tpf.co.jp>)
List pgsql-odbc
Hello,

The psotgre odbc driver seems leak memory when connection failed.



1) A program tries to connect through odbc to a psotgres server running another machine.

2) Remove the network cable from the odbc guest machine ( not from the server machine ).

3) Then memory leaks every time connection fails.

4) Leak size is small when SSL is OFF and big when SSL is ON. 20 KB to 40 KB each when SSL is ON.

5) I tried odbc version 8.3.4 and 8.4.1, and both occurred leak.



Here I try to guess the cause in the odbc driver source code.

    socket.c

    SOCK_Destructor(SocketClass *self)
    {
        mylog("SOCK_Destructor\n");
        if (!self)
            return;
        if (self->socket != (SOCKETFD) -1)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think this part is wrong and unnecessary. It is because...

When LIBPQ_connect failed to connect on some conditions, it leaves :

  - self->sock->socket = -1  and..

  - selc->sock->pqconn = pqconn ( unfreed. )

--------------------------------------------------
MORIMOTO Shouji <shoji.morimoto@soliton.co.jp>
Soliton Systems +81-3-5360-3830 FAX+81-3-5379-0280

pgsql-odbc by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: Undesired decimal truncation with psqlodbc version 08.04.0100
Next
From: Hiroshi Inoue
Date:
Subject: Re: odbc driver leaks memory when connection failed