@@ -641,7 +641,7 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
641
641
if (!argc ) return -1 ;
642
642
643
643
/* Extract our arguments into an array */
644
- z_args = emalloc (sizeof (zval * ) * argc );
644
+ z_args = emalloc (sizeof (* z_args ) * argc );
645
645
if (zend_get_parameters_array (ht , ZEND_NUM_ARGS (), z_args ) == FAILURE ) {
646
646
efree (z_args );
647
647
return -1 ;
@@ -857,7 +857,7 @@ PHP_METHOD(RedisCluster, del) {
857
857
// Initialize a LONG value to zero for our return
858
858
z_ret = emalloc (sizeof (* z_ret ));
859
859
ZVAL_LONG (z_ret , 0 );
860
-
860
+
861
861
// Parse args, process
862
862
if (cluster_mkey_cmd (INTERNAL_FUNCTION_PARAM_PASSTHRU , "DEL" ,
863
863
sizeof ("DEL" )- 1 , z_ret , cluster_del_resp )< 0 )
@@ -906,16 +906,18 @@ PHP_METHOD(RedisCluster, mset) {
906
906
907
907
/* {{{ proto array RedisCluster::msetnx(array keyvalues) */
908
908
PHP_METHOD (RedisCluster , msetnx ) {
909
- zval z_ret ;
909
+ zval * z_ret ;
910
910
911
911
// Array response
912
- array_init (& z_ret );
912
+ z_ret = emalloc (sizeof (* z_ret ));
913
+ array_init (z_ret );
913
914
914
915
// Parse args and process. If we get a failure, free mem and return FALSE
915
916
if (cluster_mset_cmd (INTERNAL_FUNCTION_PARAM_PASSTHRU , "MSETNX" ,
916
- sizeof ("MSETNX" )- 1 , & z_ret , cluster_msetnx_resp )== -1 )
917
+ sizeof ("MSETNX" )- 1 , z_ret , cluster_msetnx_resp )== -1 )
917
918
{
918
- zval_dtor (& z_ret );
919
+ zval_dtor (z_ret );
920
+ efree (z_ret );
919
921
RETURN_FALSE ;
920
922
}
921
923
}
@@ -2067,7 +2069,7 @@ PHP_METHOD(RedisCluster, watch) {
2067
2069
ht_dist = cluster_dist_create ();
2068
2070
2069
2071
// Allocate args, and grab them
2070
- z_args = emalloc (sizeof (zval * ) * argc );
2072
+ z_args = emalloc (sizeof (* z_args ) * argc );
2071
2073
if (zend_get_parameters_array (ht , argc , z_args )== FAILURE ) {
2072
2074
efree (z_args );
2073
2075
cluster_dist_free (ht_dist );
@@ -2339,10 +2341,8 @@ static void cluster_raw_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len)
2339
2341
RETURN_FALSE ;
2340
2342
}
2341
2343
2342
- /* Allocate an array to process arguments */
2343
- z_args = emalloc (argc * sizeof (zval * ));
2344
-
2345
2344
/* Grab args */
2345
+ z_args = emalloc (sizeof (* z_args ) * argc );
2346
2346
if (zend_get_parameters_array (ht , argc , z_args )== FAILURE ) {
2347
2347
efree (z_args );
2348
2348
RETURN_FALSE ;
0 commit comments