summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-06-22 16:46:24 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-06-22 16:46:24 +0000
commit77f11b9f455edda8890c05344f389866ef8d69e0 (patch)
treed1553f775d7cab3f6e4e219c80a75aa0ac77cc3a
parentb8d079a4c248f68003647451d488137ba2b160a0 (diff)
downloadphp-git-77f11b9f455edda8890c05344f389866ef8d69e0.tar.gz
Fixed bug #24284 (Fixed memory leak inside pg_ping())
-rw-r--r--ext/pgsql/pgsql.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 36e50fe46e..7374963c85 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -865,6 +865,7 @@ PHP_FUNCTION(pg_ping)
zval *pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
+ PGresult *res;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
&pgsql_link) == FAILURE) {
@@ -874,7 +875,8 @@ PHP_FUNCTION(pg_ping)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
/* ping connection */
- PQexec(pgsql, "SELECT 1;");
+ res = PQexec(pgsql, "SELECT 1;");
+ PQclear(res);
/* check status. */
if (PQstatus(pgsql) == CONNECTION_OK)