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>2018-11-07 08:20:06 +0300
committerGitHub <noreply@github.com>2018-11-07 08:20:06 +0300
commit92f14b1480b73333db595821f8335ea5ee300113 (patch)
tree1307c656c99f59feb09df3acd3ca12fc977bc02a /redis_session.c
parenteb8bcc1de86240fd9b7094994065fbf1975beabe (diff)
Fix a memory leak when regenerating IDs (#1445)
Make sure we free any existing session lock key if we're going to update it. Otherwise we will leak that memory.
Diffstat (limited to 'redis_session.c')
-rw-r--r--redis_session.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/redis_session.c b/redis_session.c
index 51bebfd4..79225071 100644
--- a/redis_session.c
+++ b/redis_session.c
@@ -616,6 +616,7 @@ PS_CREATE_SID_FUNC(redis)
#endif
}
+ if (pool->lock_status.session_key) zend_string_release(pool->lock_status.session_key);
#if (PHP_MAJOR_VERSION < 7)
pool->lock_status.session_key = redis_session_key(rpm, sid, strlen(sid));
#else
@@ -758,6 +759,7 @@ PS_READ_FUNC(redis)
}
/* send GET command */
+ if (pool->lock_status.session_key) zend_string_release(pool->lock_status.session_key);
pool->lock_status.session_key = redis_session_key(rpm, skey, skeylen);
cmd_len = REDIS_SPPRINTF(&cmd, "GET", "S", pool->lock_status.session_key);