Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2017-08-11 23:50:29 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2017-08-12 00:01:48 +0300
commite672f40bda2fbdc50b82977665c14e595c0fc990 (patch)
tree280b955376daf5e35baede01dcde249f4696e70f /redis_array.c
parent4452f6858b3310aeb8bab2d0011117ba63d68e8f (diff)
Duplicate incoming params via ZVAL_ZVAL in ra_forward_call
Diffstat (limited to 'redis_array.c')
-rw-r--r--redis_array.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/redis_array.c b/redis_array.c
index 311b34bc..7d3af374 100644
--- a/redis_array.c
+++ b/redis_array.c
@@ -374,12 +374,12 @@ ra_forward_call(INTERNAL_FUNCTION_PARAMETERS, RedisArray *ra, const char *cmd, i
/* pass call through */
ZVAL_STRINGL(&z_fun, cmd, cmd_len); /* method name */
- z_callargs = ecalloc(argc + 1, sizeof(zval));
+ z_callargs = ecalloc(argc, sizeof(zval));
/* copy args to array */
i = 0;
ZEND_HASH_FOREACH_VAL(h_args, zp_tmp) {
- z_callargs[i] = *zp_tmp;
+ ZVAL_ZVAL(&z_callargs[i], zp_tmp, 1, 0);
i++;
} ZEND_HASH_FOREACH_END();
@@ -388,6 +388,9 @@ ra_forward_call(INTERNAL_FUNCTION_PARAMETERS, RedisArray *ra, const char *cmd, i
call_user_function(&redis_ce->function_table, ra->z_multi_exec, &z_fun, return_value, argc, z_callargs);
zval_dtor(return_value);
zval_dtor(&z_fun);
+ for (i = 0; i < argc; ++i) {
+ zval_dtor(&z_callargs[i]);
+ }
efree(z_callargs);
RETURN_ZVAL(getThis(), 1, 0);
}
@@ -430,6 +433,9 @@ ra_forward_call(INTERNAL_FUNCTION_PARAMETERS, RedisArray *ra, const char *cmd, i
/* cleanup */
zval_dtor(&z_fun);
+ for (i = 0; i < argc; ++i) {
+ zval_dtor(&z_callargs[i]);
+ }
efree(z_callargs);
}