Re: Memory Leak when freeing statement

Lists: pgsql-odbc
From: Kelly Burkhart <kelly(at)tradebotsystems(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Memory Leak when freeing statement
Date: 2005-03-24 18:52:12
Message-ID: 1111690332.26601.206.camel@krb06
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-odbc

I have found a memory leak when freeing a statement handle which has had
parameters bound in psqlodbc-08.00.0101. I was able to eliminate the
leak by adding:

SC_free_params(self, STMT_FREE_PARAMS_ALL);

to line 330 of statement.c in the SC_Destructor method. I'm not
familiar enough with the code to know if this is a sensible fix.

-K


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Kelly Burkhart <kelly(at)tradebotsystems(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Memory Leak when freeing statement
Date: 2005-03-30 18:06:38
Message-ID: 200503302006.38606.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-odbc

Kelly Burkhart wrote:
> I have found a memory leak when freeing a statement handle which has
> had parameters bound in psqlodbc-08.00.0101. I was able to eliminate
> the leak by adding:
>
> SC_free_params(self, STMT_FREE_PARAMS_ALL);
>
> to line 330 of statement.c in the SC_Destructor method. I'm not
> familiar enough with the code to know if this is a sensible fix.

Can you provide an example program that shows the memory leak?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Kelly Burkhart <kelly(at)tradebotsystems(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Memory Leak when freeing statement
Date: 2005-03-30 20:39:49
Message-ID: 1112215189.3392.70.camel@krb06
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-odbc

On Wed, 2005-03-30 at 12:06, Peter Eisentraut wrote:
> Kelly Burkhart wrote:
> > I have found a memory leak when freeing a statement handle which has
> > had parameters bound in psqlodbc-08.00.0101. I was able to eliminate
> > the leak by adding:
> >
> > SC_free_params(self, STMT_FREE_PARAMS_ALL);
> >
> > to line 330 of statement.c in the SC_Destructor method. I'm not
> > familiar enough with the code to know if this is a sensible fix.
>
> Can you provide an example program that shows the memory leak?

In the attached program, each query iteration leaks 12 bytes per input
variable. Output variables have no effect.

-K

Attachment Content-Type Size
tst_odbcleak.cpp text/x-c++ 3.5 KB