ext/pgsql: fix PGtrace invalid free issue.

disable trace when closing the connection, is a no op if there is no stream
attached to it.

Close GH-11403
This commit is contained in:
David CARLIER 2023-06-08 22:52:49 +01:00 committed by David Carlier
parent 7eb3e9cd17
commit f194cdf852
3 changed files with 24 additions and 0 deletions

View file

@ -172,6 +172,7 @@ static void pgsql_link_free(pgsql_link_handle *link)
PQclear(res);
}
if (!link->persistent) {
PQuntrace(link->conn);
PQfinish(link->conn);
}
PGG(num_links)--;