aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-27 10:55:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-27 10:55:20 +0100
commita0d34edd00b42849901865e0a96b6a96f256bb80 (patch)
treebbd1718cf342105c787b25bcc2965a31370b47c0 /contrib
parent5c4c2ea802a22efc71842150d12862cdf7a5ca12 (diff)
downloadrspamd-a0d34edd00b42849901865e0a96b6a96f256bb80.tar.gz
rspamd-a0d34edd00b42849901865e0a96b6a96f256bb80.zip
[Fix] Fix couple of warnings
Diffstat (limited to 'contrib')
-rw-r--r--contrib/hiredis/dict.c8
-rw-r--r--contrib/hiredis/hiredis.c4
-rw-r--r--contrib/libucl/ucl_parser.c23
3 files changed, 30 insertions, 5 deletions
diff --git a/contrib/hiredis/dict.c b/contrib/hiredis/dict.c
index e17a62546..0fbc1b4cf 100644
--- a/contrib/hiredis/dict.c
+++ b/contrib/hiredis/dict.c
@@ -172,9 +172,11 @@ static int dictReplace(dict *ht, void *key, void *val) {
* as the previous one. In this context, think to reference counting,
* you want to increment (set), and then decrement (free), and not the
* reverse. */
- auxentry = *entry;
- dictSetHashVal(ht, entry, val);
- dictFreeEntryVal(ht, &auxentry);
+ if (entry) {
+ auxentry = *entry;
+ dictSetHashVal(ht, entry, val);
+ dictFreeEntryVal(ht, &auxentry);
+ }
return 0;
}
diff --git a/contrib/hiredis/hiredis.c b/contrib/hiredis/hiredis.c
index 2b876d913..0f87bc323 100644
--- a/contrib/hiredis/hiredis.c
+++ b/contrib/hiredis/hiredis.c
@@ -710,6 +710,8 @@ redisContext *redisConnectNonBlock(const char *ip, int port) {
redisContext *redisConnectBindNonBlock(const char *ip, int port,
const char *source_addr) {
redisContext *c = redisContextInit();
+ if (c == NULL)
+ return NULL;
c->flags &= ~REDIS_BLOCK;
redisContextConnectBindTcp(c,ip,port,NULL,source_addr);
return c;
@@ -718,6 +720,8 @@ redisContext *redisConnectBindNonBlock(const char *ip, int port,
redisContext *redisConnectBindNonBlockWithReuse(const char *ip, int port,
const char *source_addr) {
redisContext *c = redisContextInit();
+ if (c == NULL)
+ return NULL;
c->flags &= ~REDIS_BLOCK;
c->flags |= REDIS_REUSEADDR;
redisContextConnectBindTcp(c,ip,port,NULL,source_addr);
diff --git a/contrib/libucl/ucl_parser.c b/contrib/libucl/ucl_parser.c
index d6b8eb656..11b871259 100644
--- a/contrib/libucl/ucl_parser.c
+++ b/contrib/libucl/ucl_parser.c
@@ -1608,8 +1608,17 @@ ucl_parse_value (struct ucl_parser *parser, struct ucl_chunk *chunk)
break;
case '{':
obj = ucl_parser_get_container (parser);
+ if (obj == NULL) {
+ return false;
+ }
/* We have a new object */
- obj = ucl_parser_add_container (obj, parser, false, parser->stack->level);
+ if (parser->stack) {
+ obj = ucl_parser_add_container (obj, parser, false,
+ parser->stack->level);
+ }
+ else {
+ return false;
+ }
if (obj == NULL) {
return false;
}
@@ -1620,8 +1629,18 @@ ucl_parse_value (struct ucl_parser *parser, struct ucl_chunk *chunk)
break;
case '[':
obj = ucl_parser_get_container (parser);
+ if (obj == NULL) {
+ return false;
+ }
/* We have a new array */
- obj = ucl_parser_add_container (obj, parser, true, parser->stack->level);
+ if (parser->stack) {
+ obj = ucl_parser_add_container (obj, parser, true,
+ parser->stack->level);
+ }
+ else {
+ return false;
+ }
+
if (obj == NULL) {
return false;
}