@@ -340,25 +340,15 @@ create_cluster_context(zend_class_entry *class_type TSRMLS_DC) {
340
340
#endif
341
341
}
342
342
343
- /* Helper to retrieve the redisCluster object from the zend_object member */
344
- static redisCluster * getClusterObject (zend_object * object ) {
345
- #if (PHP_MAJOR_VERSION < 7 )
346
- return (redisCluster * )object ;
347
- #else
348
- return (redisCluster * )((char * )(object ) - XtOffsetOf (redisCluster , std ));
349
- #endif
350
- }
351
-
352
343
/* Free redisCluster context */
353
344
void
354
345
#if (PHP_MAJOR_VERSION < 7 )
355
- free_cluster_context (void * object TSRMLS_DC )
346
+ free_cluster_context (void * object TSRMLS_DC ) {
347
+ redisCluster * cluster = (redisCluster * )object ;
356
348
#else
357
- free_cluster_context (zend_object * object )
349
+ free_cluster_context (zend_object * object ) {
350
+ redisCluster * cluster = (redisCluster * )((char * )(object ) - XtOffsetOf (redisCluster , std ));
358
351
#endif
359
- {
360
- redisCluster * cluster = getClusterObject (object );
361
-
362
352
// Free any allocated prefix, as well as the struct
363
353
if (cluster -> flags -> prefix ) efree (cluster -> flags -> prefix );
364
354
efree (cluster -> flags );
@@ -1949,6 +1939,7 @@ static void cluster_eval_cmd(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
1949
1939
1950
1940
/* validate that this key maps to the same node */
1951
1941
if (node && c -> master [slot ] != node ) {
1942
+ if (key_free ) efree (key );
1952
1943
php_error_docref (NULL TSRMLS_CC , E_WARNING ,
1953
1944
"Keys appear to map to different nodes" );
1954
1945
RETURN_FALSE ;
@@ -1980,7 +1971,7 @@ static void cluster_eval_cmd(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
1980
1971
} else {
1981
1972
void * ctx = NULL ;
1982
1973
CLUSTER_ENQUEUE_RESPONSE (c , slot , cluster_variant_resp , ctx );
1983
- RETURN_ZVAL (getThis (), 1 , 0 );
1974
+ RETVAL_ZVAL (getThis (), 1 , 0 );
1984
1975
}
1985
1976
1986
1977
efree (cmdstr .c );
0 commit comments