Skip to content
Snippets Groups Projects
user avatar
Philippe Canal authored
when recently valgrinding our analysis-software again, I found two leaks stemming from lost pointers to prepared PgSQL-statements in TPgSQLStatement (we just started using the TSQLStatement more often some weeks ago).
The problem is that the TPgSQLServer already prepares a PGresult and adds a pointer to it to the stmt-structure which is passed to TPgSQLStatement.
The TPgSQLStatement creates a new prepared statement in its constructor and overrides this pointer with it.
In TPgSQLStatement:Process(), this pointer is overwritten again.

To not break any existing usecases of this, the attached patch fixes this problem by first PQclear'ing the prepared result if it is not NULL. This fixes both leaks (and at the moment, I do not observe more leaks in our usage of the TPgSQLStatement).

[From Oliver Freyermuth]
055ff090
History
Name Last commit Last update
..
inc
src
CMakeLists.txt
Module.mk