Skip to content

Commit cb5d6b9

Browse files
Don't double free the cache key
Addresses #1591
1 parent 148bf37 commit cb5d6b9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cluster_library.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,8 @@ cluster_free(redisCluster *c, int free_ctx)
892892
if (c->cache_key) {
893893
if (c->redirections) {
894894
zend_hash_del(&EG(persistent_list), c->cache_key);
895+
c->cache_key = NULL;
895896
}
896-
zend_string_release(c->cache_key);
897897
}
898898

899899
/* Free structure itself */

redis.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,10 @@ free_reply_callbacks(RedisSock *redis_sock)
559559

560560
/* Passthru for destroying cluster cache */
561561
static void cluster_cache_dtor(zend_resource *rsrc) {
562-
redisCachedCluster *rcc = (redisCachedCluster*)rsrc->ptr;
563-
cluster_cache_free(rcc);
562+
if (rsrc->ptr) {
563+
redisCachedCluster *rcc = (redisCachedCluster*)rsrc->ptr;
564+
cluster_cache_free(rcc);
565+
}
564566
}
565567

566568
void

0 commit comments

Comments
 (0)