Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2019-07-17 02:59:58 +0300
committermichael-grunder <michael.grunder@gmail.com>2019-07-17 03:28:30 +0300
commitcb5d6b9486486c0eb290f57bf7e85437c54bbbd5 (patch)
tree1a7cbf335748974fcf87e7811af343e2fb1c20a3
parent148bf373b7a0d276f6f6fd1ec1e6b9407fba6497 (diff)
Don't double free the cache key
Addresses #1591
-rw-r--r--cluster_library.c2
-rw-r--r--redis.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/cluster_library.c b/cluster_library.c
index 767e95b0..fc49e127 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -892,8 +892,8 @@ cluster_free(redisCluster *c, int free_ctx)
if (c->cache_key) {
if (c->redirections) {
zend_hash_del(&EG(persistent_list), c->cache_key);
+ c->cache_key = NULL;
}
- zend_string_release(c->cache_key);
}
/* Free structure itself */
diff --git a/redis.c b/redis.c
index b087ac44..504fcdaf 100644
--- a/redis.c
+++ b/redis.c
@@ -559,8 +559,10 @@ free_reply_callbacks(RedisSock *redis_sock)
/* Passthru for destroying cluster cache */
static void cluster_cache_dtor(zend_resource *rsrc) {
- redisCachedCluster *rcc = (redisCachedCluster*)rsrc->ptr;
- cluster_cache_free(rcc);
+ if (rsrc->ptr) {
+ redisCachedCluster *rcc = (redisCachedCluster*)rsrc->ptr;
+ cluster_cache_free(rcc);
+ }
}
void