From 18a2d36b327158b3eca3a4486f4dfb5d0f467740 Mon Sep 17 00:00:00 2001 From: Nicolas Favre-Felix Date: Fri, 3 Dec 2010 09:44:52 +0100 Subject: Added extra check on free. --- library.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library.c b/library.c index 8b5e80df..b1591ff0 100644 --- a/library.c +++ b/library.c @@ -793,7 +793,9 @@ PHPAPI int redis_sock_server_open(RedisSock *redis_sock, int force_connect TSRML */ PHPAPI int redis_sock_disconnect(RedisSock *redis_sock TSRMLS_DC) { - int res = 0; + if (redis_sock == NULL) { + return 1; + } if (redis_sock->stream != NULL) { redis_sock_write(redis_sock, "QUIT", sizeof("QUIT") - 1 TSRMLS_CC); @@ -804,10 +806,10 @@ PHPAPI int redis_sock_disconnect(RedisSock *redis_sock TSRMLS_DC) } redis_sock->stream = NULL; - res = 1; + return 1; } - return res; + return 0; } /** -- cgit v1.2.3