Browse Source

[Fix] Fix couple of warnings

tags/1.7.0
Vsevolod Stakhov 6 years ago
parent
commit
a0d34edd00

+ 5
- 3
contrib/hiredis/dict.c View File

@@ -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;
}


+ 4
- 0
contrib/hiredis/hiredis.c View File

@@ -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);

+ 21
- 2
contrib/libucl/ucl_parser.c View File

@@ -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;
}

+ 2
- 2
src/libmime/archives.c View File

@@ -700,7 +700,7 @@ rspamd_7zip_read_bits (struct rspamd_task *task,
struct rspamd_archive *arch, guint nbits,
guint *pbits_set)
{
unsigned mask, avail, i;
unsigned mask = 0, avail = 0, i;
gboolean bit_set = 0;

for (i = 0; i < nbits; i++) {
@@ -710,7 +710,7 @@ rspamd_7zip_read_bits (struct rspamd_task *task,
mask = 0x80;
}

bit_set = (avail & mask)?1:0;
bit_set = (avail & mask) ? 1 : 0;

if (bit_set && pbits_set) {
(*pbits_set) ++;

+ 1
- 0
src/libserver/dkim.c View File

@@ -2820,6 +2820,7 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,

switch (ctx->common.type) {
case RSPAMD_DKIM_NORMAL:
default:
hname = RSPAMD_DKIM_SIGNHEADER;
break;
case RSPAMD_DKIM_ARC_SIG:

+ 3
- 3
src/libserver/spf.c View File

@@ -1474,9 +1474,9 @@ static const gchar *
expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,
const gchar *begin)
{
const gchar *p, *macro_value;
gchar *c, *new, *tmp, delim;
gsize len = 0, slen = 0, macro_len;
const gchar *p, *macro_value = NULL;
gchar *c, *new, *tmp, delim = '.';
gsize len = 0, slen = 0, macro_len = 0;
gint state = 0, ndelim = 0;
gchar ip_buf[INET6_ADDRSTRLEN + 1];
gboolean need_expand = FALSE, reversed;

+ 1
- 1
src/libutil/ssl_util.c View File

@@ -364,7 +364,7 @@ rspamd_tls_set_error (gint retcode, const gchar *stage, GError **err)
{
GString *reason;
gchar buf[120];
gint err_code, last_err;
gint err_code = 0, last_err = 0;

reason = g_string_sized_new (sizeof (buf));


+ 5
- 8
src/plugins/fuzzy_check.c View File

@@ -2830,7 +2830,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
struct fuzzy_rule *rule;
struct rspamd_controller_session *session = conn_ent->ud;
struct rspamd_task *task, **ptask;
gboolean processed = FALSE, res = TRUE, skip;
gboolean processed = FALSE, res = TRUE, skip = FALSE;
guint i;
GError **err;
GPtrArray *commands;
@@ -2935,7 +2935,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
if (is_hash) {
GPtrArray *args;
const rspamd_ftok_t *arg;
guint i;
guint j;

args = rspamd_http_message_find_header_multiple (msg, "Hash");

@@ -2943,8 +2943,8 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
struct fuzzy_cmd_io *io;
commands = g_ptr_array_sized_new (args->len);

for (i = 0; i < args->len; i ++) {
arg = g_ptr_array_index (args, i);
for (j = 0; j < args->len; j ++) {
arg = g_ptr_array_index (args, j);
io = fuzzy_cmd_hash (rule, cmd, arg, flag, value,
task->task_pool);

@@ -2996,6 +2996,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
strerror (errno));
rspamd_controller_send_error (conn_ent, 400, "Message sending error");
rspamd_task_free (task);

return;
}
else if (!processed) {
@@ -3019,11 +3020,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent,
}
}
rspamd_task_free (task);

return;
}

return;
}

static int

Loading…
Cancel
Save