summaryrefslogtreecommitdiff
path: root/ext/dbx
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-02-13 13:11:36 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-02-13 13:11:36 +0000
commitd43e8898547184c3031f74cf2e93fdad59502a18 (patch)
treeab8881ed1314ce8d73be6685c36651254fec1ce6 /ext/dbx
parent6d3d668887467051b0fc5f366b8290a36ea3df01 (diff)
downloadphp-git-d43e8898547184c3031f74cf2e93fdad59502a18.tar.gz
Fix memory leaks.
Diffstat (limited to 'ext/dbx')
-rw-r--r--ext/dbx/dbx_pgsql.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/dbx/dbx_pgsql.c b/ext/dbx/dbx_pgsql.c
index c85dd3c5a6..88e28816ee 100644
--- a/ext/dbx/dbx_pgsql.c
+++ b/ext/dbx/dbx_pgsql.c
@@ -47,7 +47,7 @@ int dbx_pgsql_connect(zval **rv, zval **host, zval **db, zval **username, zval *
sprintf(connstring, "host='%s' port='%s' dbname='%s' user='%s' password='%s'",
Z_STRVAL_PP(host), port, Z_STRVAL_PP(db),
Z_STRVAL_PP(username), Z_STRVAL_PP(password));
- ZVAL_STRING(conn_zval, connstring, 1);
+ ZVAL_STRING(conn_zval, connstring, 0);
args[0] = &conn_zval;
nargs = 1;
} else {
@@ -62,6 +62,8 @@ int dbx_pgsql_connect(zval **rv, zval **host, zval **db, zval **username, zval *
args[4] = db;
}
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_connect", &returned_zval, nargs, args);
+ zval_dtor(conn_zval);
+ FREE_ZVAL(conn_zval);
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
if (returned_zval) zval_ptr_dtor(&returned_zval);
@@ -92,7 +94,7 @@ int dbx_pgsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval
sprintf(connstring, "host='%s' port='%s' dbname='%s' user='%s' password='%s'",
Z_STRVAL_PP(host), port, Z_STRVAL_PP(db),
Z_STRVAL_PP(username), Z_STRVAL_PP(password));
- ZVAL_STRING(conn_zval, connstring, 1);
+ ZVAL_STRING(conn_zval, connstring, 0);
args[0] = &conn_zval;
nargs = 1;
} else {
@@ -107,6 +109,8 @@ int dbx_pgsql_pconnect(zval **rv, zval **host, zval **db, zval **username, zval
args[4] = db;
}
dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_pconnect", &returned_zval, nargs, args);
+ zval_dtor(conn_zval);
+ FREE_ZVAL(conn_zval);
if (!returned_zval || Z_TYPE_P(returned_zval)!=IS_RESOURCE) {
if (returned_zval) zval_ptr_dtor(&returned_zval);