Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb24d0e

Browse files
committed
Bugfix: Forgot to allocate memory for persistent_id
1 parent 7713cc5 commit bb24d0e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ PHPAPI void redis_ping_response(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_s
755755
*/
756756
PHPAPI RedisSock* redis_sock_create(char *host, int host_len, unsigned short port,
757757
double timeout, int persistent, char *persistent_id,
758-
int persistent_id_len)
758+
int persistent_id_len)
759759
{
760760
RedisSock *redis_sock;
761761

@@ -767,6 +767,7 @@ PHPAPI RedisSock* redis_sock_create(char *host, int host_len, unsigned short por
767767
redis_sock->persistent = persistent;
768768

769769
if (persistent_id) {
770+
redis_sock->persistent_id = ecalloc(persistent_id_len + 1, 1);
770771
memcpy(redis_sock->persistent_id, persistent_id, persistent_id_len);
771772
redis_sock->persistent_id[persistent_id_len] = '\0';
772773
} else {

0 commit comments

Comments
 (0)