mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed bug #24284 (Fixed memory leak inside pg_ping())
This commit is contained in:
parent
b8d079a4c2
commit
77f11b9f45
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user