From 8ca0f67807848143470178fb535ea53cdcd8aad2 Mon Sep 17 00:00:00 2001 From: Mike Magin Date: Tue, 4 Apr 2017 11:16:10 -0400 Subject: [PATCH] Always clear out libpq results before reassigning: fixes leak in putcopyend --- dbdimp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbdimp.c b/dbdimp.c index aab8cc9..dfc2173 100644 --- a/dbdimp.c +++ b/dbdimp.c @@ -3892,6 +3892,7 @@ int pg_db_getcopydata (SV * dbh, SV * dataline, int async) result = PQgetResult(imp_dbh->conn); status = _sqlstate(aTHX_ imp_dbh, result); while (result != NULL) { + PQclear(result); result = PQgetResult(imp_dbh->conn); } TRACE_PQCLEAR; @@ -3986,6 +3987,7 @@ int pg_db_putcopyend (SV * dbh) result = PQgetResult(imp_dbh->conn); status = _sqlstate(aTHX_ imp_dbh, result); while (result != NULL) { + PQclear(result); result = PQgetResult(imp_dbh->conn); } TRACE_PQCLEAR; -- 2.31.1