diff options
author | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2010-12-03 11:44:52 +0300 |
---|---|---|
committer | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2010-12-03 11:44:52 +0300 |
commit | 18a2d36b327158b3eca3a4486f4dfb5d0f467740 (patch) | |
tree | 17990083511bf68875a508c69856e0354e601b8a | |
parent | 449ec8a0998ae4a22f73e55a2b05321a2e71d058 (diff) |
Added extra check on free.
-rw-r--r-- | library.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; } /** |