Thread: Memory Leak when freeing statement

Memory Leak when freeing statement

From
Kelly Burkhart
Date:
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

Re: Memory Leak when freeing statement

From
Peter Eisentraut
Date:
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/

Re: Memory Leak when freeing statement

From
Kelly Burkhart
Date:
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