summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincas Dargis <vindrg@gmail.com>2015-12-05 15:20:34 +0200
committerMark Brand <mabrand@mabrand.nl>2015-12-12 10:21:13 +0000
commite8eaf82e584c2d27bdeb0a50055e10d55d9c00dc (patch)
tree6f4d5670d3242581bdcc7acbdad1ee43a30de294 /src
parentb2c7c489ab40efb1f2f64aba5b90f5f4fb8d8536 (diff)
PostgreSQL: Fix memory leak in QPSQLDriverPrivate::getPSQLVersion()
Memory leak occurs when 'release' pointer variable is overwritten for second use without releasing resources it is currently pointing to. Leak occurs only in specific edge case depending on client/server versions. Task-number: QTBUG-49789 Change-Id: Ie5be8996ed158309f20dbb3574f956d2eb137460 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src')
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index f4e40b6582..4795738b66 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -757,6 +757,7 @@ QPSQLDriver::Protocol QPSQLDriverPrivate::getPSQLVersion()
//Client version before QPSQLDriver::Version9 only supports escape mode for bytea type,
//but bytea format is set to hex by default in PSQL 9 and above. So need to force the
//server use the old escape mode when connects to the new server with old client library.
+ PQclear(result);
result = exec("SET bytea_output=escape; ");
status = PQresultStatus(result);
} else if (serverVersion == QPSQLDriver::VersionUnknown) {