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:
authormichael-grunder <michael.grunder@gmail.com>2013-08-07 01:19:23 +0400
committermichael-grunder <michael.grunder@gmail.com>2013-08-07 01:19:23 +0400
commitcdd437ec5985e180323bac07d989adf054f2c023 (patch)
treefb16befabc40d7359d6ac0535a9a1107124ab1a3
parent1a8b049d4f56c22308189baafb58dfe03dcdab3a (diff)
parent641841012f15ed63943718d8a155780a7f2a9f6c (diff)
Merge branch 'hotfix/ra_mget_segfault'ra_mget_segfault
-rw-r--r--redis_array.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/redis_array.c b/redis_array.c
index 4d5f0a97..31f77278 100644
--- a/redis_array.c
+++ b/redis_array.c
@@ -849,7 +849,6 @@ PHP_METHOD(RedisArray, mget)
/* calls */
for(n = 0; n < ra->count; ++n) { /* for each node */
-
/* copy args for MGET call on node. */
MAKE_STD_ZVAL(z_argarray);
array_init(z_argarray);
@@ -873,7 +872,21 @@ PHP_METHOD(RedisArray, mget)
zval_ptr_dtor(&z_argarray);
for(i = 0, j = 0; i < argc; ++i) {
- if(pos[i] != n) continue;
+ /* Error out if we didn't get a proper response */
+ if(Z_TYPE_P(z_ret) != IS_ARRAY) {
+ /* cleanup */
+ zval_dtor(z_ret);
+ efree(z_ret);
+ zval_ptr_dtor(&z_tmp_array);
+ efree(pos);
+ efree(redis_instances);
+ efree(argc_each);
+
+ /* failure */
+ RETURN_FALSE;
+ }
+
+ if(pos[i] != n) continue;
zend_hash_quick_find(Z_ARRVAL_P(z_ret), NULL, 0, j, (void**)&z_cur);
j++;
@@ -886,7 +899,6 @@ PHP_METHOD(RedisArray, mget)
}
zval_dtor(z_ret);
efree(z_ret);
-
}
/* copy temp array in the right order to return_value */