10000 Make sure redisCluster members are all initialized on (re)creation · jrtkcoder/phpredis@162d882 · GitHub
[go: up one dir, main page]

Skip to content

Commit 162d882

Browse files
Make sure redisCluster members are all initialized on (re)creation
Fixes phpredis#1105
1 parent 88d870e commit 162d882

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

redis_cluster.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,23 +282,19 @@ create_cluster_context(zend_class_entry *class_type TSRMLS_DC) {
282282
redisCluster *cluster;
283283

284284
// Allocate our actual struct
285-
cluster = emalloc(sizeof(redisCluster));
286-
memset(cluster, 0, sizeof(redisCluster));
285+
cluster = ecalloc(1, sizeof(redisCluster));
287286
#else
288287
zend_object *
289288
create_cluster_context(zend_class_entry *class_type TSRMLS_DC) {
290289
redisCluster *cluster;
291290

292291
// Allocate our actual struct
293-
cluster = emalloc(sizeof(redisCluster) + sizeof(zval) * (class_type->default_properties_count - 1));
292+
cluster = ecalloc(1, sizeof(redisCluster) + sizeof(zval) * (class_type->default_properties_count - 1));
294293
#endif
295294

296295
// We're not currently subscribed anywhere
297296
cluster->subscribed_slot = -1;
298297

299-
// Assume we're up initially
300-
cluster->clusterdown = 0;
301-
302298
// Allocate our RedisSock we'll use to store prefix/serialization flags
303299
cluster->flags = ecalloc(1, sizeof(RedisSock));
304300

0 commit comments

Comments
 (0)
0