summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 891861f1f7..816e9dba99 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1306,7 +1306,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
smart_str_append_long(&str, Z_LVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW);
}
}
- convert_to_string_ex(&args[i]);
+ ZVAL_STR(&args[i], zval_get_string(&args[i]));
smart_str_appendc(&str, '_');
smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRLEN(args[i]));
}
@@ -1333,7 +1333,6 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
break;
}
}
- efree(args);
if (persistent && PGG(allow_persistent)) {
zend_resource *le;
@@ -1377,7 +1376,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
PGG(num_persistent)++;
} else { /* we do */
if (le->type != le_plink) {
- RETURN_FALSE;
+ goto err;
}
/* ensure that the link did not die */
if (PGG(auto_reset_persistent) & 1) {
@@ -1428,7 +1427,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
zend_resource *link;
if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
+ goto err;
}
link = (zend_resource *)index_ptr->ptr;
@@ -1494,10 +1493,18 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
php_pgsql_set_default_link(Z_RES_P(return_value));
cleanup:
+ for (i = 0; i < ZEND_NUM_ARGS(); i++) {
+ zval_dtor(&args[i]);
+ }
+ efree(args);
smart_str_free(&str);
return;
err:
+ for (i = 0; i < ZEND_NUM_ARGS(); i++) {
+ zval_dtor(&args[i]);
+ }
+ efree(args);
smart_str_free(&str);
RETURN_FALSE;
}