@@ -884,7 +884,7 @@ ra_expire_key(const char *key, int key_len, zval *z_to, long ttl TSRMLS_DC) {
884884static zend_bool
885885ra_move_zset (const char * key , int key_len , zval * z_from , zval * z_to , long ttl TSRMLS_DC ) {
886886
887- zval z_fun_zrange , z_fun_zadd , z_ret , * z_args [4 ], * * z_zadd_args , * * z_score_pp ;
887+ zval z_fun_zrange , z_fun_zadd , z_ret , z_ret_dest , * z_args [4 ], * * z_zadd_args , * * z_score_pp ;
888888 int count ;
889889 HashTable * h_zset_vals ;
890890 char * val ;
@@ -953,7 +953,7 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
953953 ZVAL_STRINGL (& z_fun_zadd , "ZADD" , 4 , 0 );
954954 MAKE_STD_ZVAL (z_zadd_args [0 ]);
955955 ZVAL_STRINGL (z_zadd_args [0 ], key , key_len , 0 );
956- call_user_function (& redis_ce -> function_table , & z_to , & z_fun_zadd , & z_ret , 1 + 2 * count , z_zadd_args TSRMLS_CC );
956+ call_user_function (& redis_ce -> function_table , & z_to , & z_fun_zadd , & z_ret_dest , 1 + 2 * count , z_zadd_args TSRMLS_CC );
957957
958958 /* Expire if needed */
959959 ra_expire_key (key , key_len , z_to , ttl TSRMLS_CC );
@@ -963,6 +963,8 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
963963 efree (z_zadd_args [i ]);
964964 }
965965
966+ zval_dtor (& z_ret );
967+
966968 /* Free the array itself */
967969 efree (z_zadd_args );
968970
@@ -1021,7 +1023,7 @@ ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl
10211023static zend_bool
10221024ra_move_hash (const char * key , int key_len , zval * z_from , zval * z_to , long ttl TSRMLS_DC ) {
10231025
1024- zval z_fun_hgetall , z_fun_hmset , z_ret , * z_args [2 ];
1026+ zval z_fun_hgetall , z_fun_hmset , z_ret , z_ret_dest , * z_args [2 ];
10251027
10261028 /* run HGETALL on source */
10271029 MAKE_STD_ZVAL (z_args [0 ]);
@@ -1039,13 +1041,14 @@ ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS
10391041 ZVAL_STRINGL (& z_fun_hmset , "HMSET" , 5 , 0 );
10401042 ZVAL_STRINGL (z_args [0 ], key , key_len , 0 );
10411043 z_args [1 ] = & z_ret ; /* copy z_ret to arg 1 */
1042- call_user_function (& redis_ce -> function_table , & z_to , & z_fun_hmset , & z_ret , 2 , z_args TSRMLS_CC );
1044+ call_user_function (& redis_ce -> function_table , & z_to , & z_fun_hmset , & z_ret_dest , 2 , z_args TSRMLS_CC );
10431045
10441046 /* Expire if needed */
10451047 ra_expire_key (key , key_len , z_to , ttl TSRMLS_CC );
10461048
10471049 /* cleanup */
10481050 efree (z_args [0 ]);
1051+ zval_dtor (& z_ret );
10491052
10501053 return 1 ;
10511054}
@@ -1107,7 +1110,11 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
11071110 * (z_sadd_args [i + 1 ]) = * * z_data_pp ;
11081111 zval_copy_ctor (z_sadd_args [i + 1 ]);
11091112 }
1110- call_user_function (& redis_ce -> function_table , & z_to , & z_fun_sadd , & z_ret , count + 1 , z_sadd_args TSRMLS_CC );
1113+
1114+ /* Clean up our input return value */
1115+ zval_dtor (& z_ret );
1116+
1117+ call_user_function (& redis_ce -> function_table , & z_to , & z_fun_sadd , & z_ret , count + 1 , z_sadd_args TSRMLS_CC );
11111118
11121119 /* Expire if needed */
11131120 ra_expire_key (key , key_len , z_to , ttl TSRMLS_CC );
@@ -1121,6 +1128,9 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
11211128 }
11221129 efree (z_sadd_args );
11231130
1131+ /* Clean up our output return value */
1132+ zval_dtor (& z_ret );
1133+
11241134 return 1 ;
11251135}
11261136
0 commit comments