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

Skip to content

Commit 735025d

Browse files
committed
Fix some static analyzer warnings
Two types of warnings were fixed in this commit: 1. The left operand of '<=' is a garbage value 2. Function call argument is an uninitialized value
1 parent ea15ce2 commit 735025d

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

cluster_library.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,6 +2074,7 @@ PHP_REDIS_API void cluster_client_list_resp(INTERNAL_FUNCTION_PARAMETERS, redisC
20742074
PHP_REDIS_API zval *cluster_zval_mbulk_resp(INTERNAL_FUNCTION_PARAMETERS,
20752075
redisCluster *c, int pull, mbulk_cb cb, zval *z_ret)
20762076
{
2077+
ZVAL_NULL(z_ret);
20772078
// Pull our next response if directed
20782079
if(pull) {
20792080
if(cluster_check_response(c, &c->reply_type TSRMLS_CC)<0)

library.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ redis_sock_read_multibulk_reply_zval(INTERNAL_FUNCTION_PARAMETERS,
430430
int numElems;
431431
size_t len;
432432

433+
ZVAL_NULL(z_tab);
433434
if (redis_sock_gets(redis_sock, inbuf, sizeof(inbuf) - 1, &len TSRMLS_CC) < 0) {
434435
return NULL;
435436
}
@@ -1787,6 +1788,8 @@ redis_serialize(RedisSock *redis_sock, zval *z, char **val, strlen_t *val_len
17871788
uint8_t *val8;
17881789
#endif
17891790

1791+
*val = NULL;
1792+
*val_len = 0;
17901793
switch(redis_sock->serializer) {
17911794
case REDIS_SERIALIZER_NONE:
17921795
switch(Z_TYPE_P(z)) {
@@ -1977,6 +1980,7 @@ redis_read_reply_type(RedisSock *redis_sock, REDIS_REPLY_TYPE *reply_type,
19771980
// Make sure we haven't lost the connection, even trying to reconnect
19781981
if(-1 == redis_check_eof(redis_sock, 0 TSRMLS_CC)) {
19791982
// Failure
1983+
*reply_type = EOF;
19801984
return -1;
19811985
}
19821986

redis_array_impl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
300300
}
301301

302302
/* find read timeout option */
303-
array_init(&z_params_connect_timeout);
303+
array_init(&z_params_read_timeout);
304304
if ((iptr = INI_STR("redis.arrays.readtimeout")) != NULL) {
305305
sapi_module.treat_data(PARSE_STRING, estrdup(iptr), &z_params_read_timeout TSRMLS_CC);
306306
}

0 commit comments

Comments
 (0)