@@ -567,7 +567,7 @@ typedef struct clusterKeyValHT {
567567static int get_key_val_ht (redisCluster * c , HashTable * ht , HashPosition * ptr ,
568568 clusterKeyValHT * kv TSRMLS_DC )
569569{
570- zval * * z_val ;
570+ zval * z_val ;
571571 unsigned int key_len ;
572572 ulong idx ;
573573
@@ -593,14 +593,14 @@ static int get_key_val_ht(redisCluster *c, HashTable *ht, HashPosition *ptr,
593593 kv -> slot = cluster_hash_key (kv -> key , kv -> key_len );
594594
595595 // Now grab our value
596- if ( zend_hash_get_current_data_ex (ht , ( void * * ) & z_val , ptr )== FAILURE ) {
596+ if (( z_val = zend_hash_get_current_data_ex (ht , ptr )) == NULL ) {
597597 zend_throw_exception (redis_cluster_exception_ce ,
598598 "Internal Zend HashTable error" , 0 TSRMLS_CC );
599599 return -1 ;
600600 }
601601
602602 // Serialize our value if required
603- kv -> val_free = redis_serialize (c -> flags ,* z_val ,& (kv -> val ),& (kv -> val_len )
603+ kv -> val_free = redis_serialize (c -> flags ,z_val ,& (kv -> val ),& (kv -> val_len )
604604 TSRMLS_CC );
605605
606606 // Success
@@ -611,20 +611,20 @@ static int get_key_val_ht(redisCluster *c, HashTable *ht, HashPosition *ptr,
611611static int get_key_ht (redisCluster * c , HashTable * ht , HashPosition * ptr ,
612612 clusterKeyValHT * kv TSRMLS_DC )
613613{
614- zval * * z_key ;
614+ zval * z_key ;
615615
616- if ( zend_hash_get_current_data_ex (ht , ( void * * ) & z_key , ptr )== FAILURE ) {
616+ if (( z_key = zend_hash_get_current_data_ex (ht , ptr )) == NULL ) {
617617 // Shouldn't happen, but check anyway
618618 zend_throw_exception (redis_cluster_exception_ce ,
619619 "Internal Zend HashTable error" , 0 TSRMLS_CC );
620620 return -1 ;
621621 }
622622
623623 // Always want to work with strings
624- convert_to_string (* z_key );
624+ convert_to_string (z_key );
625625
626- kv -> key = Z_STRVAL_PP (z_key );
627- kv -> key_len = Z_STRLEN_PP (z_key );
626+ kv -> key = Z_STRVAL_P (z_key );
627+ kv -> key_len = Z_STRLEN_P (z_key );
628628 kv -> key_free = redis_key_prefix (c -> flags , & (kv -> key ), & (kv -> key_len ));
629629
630630 // Hash our key
@@ -645,7 +645,7 @@ static HashTable *method_args_to_ht(zval *z_args, int argc) {
645645
646646 /* Populate our return hash table with our arguments */
647647 for (i = 0 ; i < argc ; i ++ ) {
648- zend_hash_next_index_insert (ht_ret , & z_args [i ], sizeof ( zval ), NULL );
648+ zend_hash_next_index_insert (ht_ret , & z_args [i ]);
649649 }
650650
651651 /* Return our hash table */
@@ -669,8 +669,8 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
669669 if (!argc ) return -1 ;
670670
671671 /* Extract our arguments into an array */
672- z_args = emalloc ( sizeof (zval )* argc );
673- if (zend_get_parameters_array (ht , ZEND_NUM_ARGS () , z_args ) == FAILURE ) {
672+ z_args = ecalloc ( argc , sizeof (zval ));
673+ if (zend_get_parameters_array (ht , argc , z_args ) == FAILURE ) {
674674 efree (z_args );
675675 return -1 ;
676676 }
@@ -688,9 +688,6 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
688688 ht_free = 1 ;
689689 }
690690
691- /* We no longer need our array args */
692- efree (z_args );
693-
694691 /* MGET is readonly, DEL is not */
695692 c -> readonly = kw_len == 4 && CLUSTER_IS_ATOMIC (c );
696693
@@ -701,6 +698,7 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
701698 // it's the first iteration every time, needlessly
702699 zend_hash_internal_pointer_reset_ex (ht_arr , & ptr );
703700 if (get_key_ht (c , ht_arr , & ptr , & kv TSRMLS_CC )< 0 ) {
701+ efree (z_args );
704702 return -1 ;
705703 }
706704
@@ -722,6 +720,7 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
722720 zend_hash_destroy (ht_arr );
723721 efree (ht_arr );
724722 }
723+ efree (z_args );
725724 return -1 ;
726725 }
727726
@@ -736,6 +735,7 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
736735 zend_hash_destroy (ht_arr );
737736 efree (ht_arr );
738737 }
738+ efree (z_args );
739739 return -1 ;
740740 }
741741 }
@@ -752,6 +752,7 @@ static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
752752
753753 zend_hash_move_forward_ex (ht_arr , & ptr );
754754 }
755+ efree (z_args );
755756
756757 // If we've got straggler(s) process them
757758 if (mc .argc > 0 ) {
0 commit comments