cvs: php4 /ext/dbx dbx_pgsql.c

From: Date: Wed, 13 Feb 2002 13:11:36 +0000
Subject: cvs: php4 /ext/dbx dbx_pgsql.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9364@lists.php.net to get a copy of this message
yohgaki Wed Feb 13 08:11:36 2002 EDT Modified files: /php4/ext/dbx dbx_pgsql.c Log: Fix memory leaks. Index: php4/ext/dbx/dbx_pgsql.c diff -u php4/ext/dbx/dbx_pgsql.c:1.16 php4/ext/dbx/dbx_pgsql.c:1.17 --- php4/ext/dbx/dbx_pgsql.c:1.16 Wed Feb 13 06:09:48 2002 +++ php4/ext/dbx/dbx_pgsql.c Wed Feb 13 08:11:36 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dbx_pgsql.c,v 1.16 2002/02/13 11:09:48 mboeren Exp $ */ +/* $Id: dbx_pgsql.c,v 1.17 2002/02/13 13:11:36 yohgaki Exp $ */ #include "dbx.h" #include "php_dbx.h" @@ -47,7 +47,7 @@ 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 @@ 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 @@ 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 @@ 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);

« previous php.cvs (#9364) next »