Fixed a leak in postgresql.c

This commit is contained in:
BlackLight 2010-09-16 17:24:53 +02:00
parent b2ac185671
commit b40dca6b14

View file

@ -116,8 +116,16 @@ postgresql_fetch_row ( PSQL_result *res )
void void
postgresql_free_result ( PSQL_result *res ) postgresql_free_result ( PSQL_result *res )
{ {
int i, j, ntuples;
if ( res ) if ( res )
{ {
ntuples = PQntuples ( res->res );
for ( i=0; i < ntuples; i++ )
free ( res->rows[i] );
free ( res->rows );
PQclear ( res->res ); PQclear ( res->res );
free ( res ); free ( res );
} }