diff --git a/src/core/dns_cache.c b/src/core/dns_cache.c index d9333001871..7f3e33875d5 100644 --- a/src/core/dns_cache.c +++ b/src/core/dns_cache.c @@ -2929,7 +2929,6 @@ inline static int dns_a_resolve( struct dns_hash_entry** e, goto error; /* found */ *rr_no=0; - ret=-E_DNS_BAD_IP_ENTRY; } now=get_ticks_raw(); /* if the entry has already expired use the time at the end of lifetime */ @@ -2978,7 +2977,6 @@ inline static int dns_aaaa_resolve( struct dns_hash_entry** e, goto error; /* found */ *rr_no=0; - ret=-E_DNS_BAD_IP_ENTRY; } now=get_ticks_raw(); /* if the entry has already expired use the time at the end of lifetime */ @@ -3112,7 +3110,6 @@ inline static int dns_srv_resolve_nxt(struct dns_hash_entry** e, if (tried) srv_reset_tried(tried); #endif - ret=-E_DNS_BAD_SRV_ENTRY; } now=get_ticks_raw(); /* if the entry has already expired use the time at the end of lifetime */ @@ -4350,11 +4347,12 @@ int dns_cache_add_record(unsigned short type, break; /* insert here */ } - if (!rr_p) + if (!rr_p) { for ( rr_p = rr_iter; *rr_p && (*rr_p != new_rr); rr_p = &((*rr_p)->next) ); + } if (!rr_p) { LM_ERR("Failed to correct the orderd list of SRV resource records\n"); goto error; diff --git a/src/core/kemi.c b/src/core/kemi.c index 941c814ab04..fd25c155f6b 100644 --- a/src/core/kemi.c +++ b/src/core/kemi.c @@ -1161,10 +1161,10 @@ str *sr_kemi_param_map_get_params(int *ptypes) pn = sr_kemi_param_map_get_name(SR_KEMIP_NONE); if(pn == NULL) return NULL; - if(pn->lens); + if(pn->lens, pn->len); } done: sret.s = pbuf; sret.len = strlen(sret.s); return &sret; -} +} \ No newline at end of file diff --git a/src/core/select_core.c b/src/core/select_core.c index 2aef43116db..d1f2ae7b4d8 100644 --- a/src/core/select_core.c +++ b/src/core/select_core.c @@ -679,18 +679,7 @@ int select_anyheader(str* res, select_t* s, struct sip_msg* msg) return 0; } -//ABSTRACT_F(select_anyheader_params) -// Instead of ABSTRACT_F(select_anyheader_params) -// use function which uses select_core_table -// to avoid gcc warning about not used - -int select_anyheader_params(str* res, select_t* s, struct sip_msg* msg) -{ - if (select_core_table.next) - return -1; - else - return -1; -} +ABSTRACT_F(select_anyheader_params) ABSTRACT_F(select_any_uri) @@ -1565,7 +1554,8 @@ int select_sys_now_fmt(str* res, select_t* s, struct sip_msg* msg) tm = localtime(&t); break; default: - BUG("Unexpected parameter value 'now' \"%d\"\n", s->params[SEL_POS].v.i); + BUG("Unexpected parameter value 'now' \"%d\" (%p)\n", + s->params[SEL_POS].v.i, select_core_table.next); return -1; } if (s->n <= SEL_POS+1) { diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index 75feb6d505b..06812db5092 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -412,6 +412,10 @@ static int init_sock_opt_accept(int s) static int tcp_safe_close(int s) { int ret; + + if(s<0) + return 0; + retry: if (unlikely((ret = close(s)) < 0 )) { switch(errno) { @@ -3066,8 +3070,8 @@ static int send_fd_queue_init(struct tcp_send_fd_q *q, unsigned int size) LM_ERR("out of memory\n"); return -1; } - q->crt=&q->data[0]; - q->end=&q->data[size]; + q->crt=q->data; + q->end=q->data+size; return 0; } @@ -3126,9 +3130,9 @@ inline static int send_fd_queue_add( struct tcp_send_fd_q* q, LM_ERR("out of memory\n"); goto error; } - q->crt=(q->crt-&q->data[0])+tmp; + q->crt=(q->crt-q->data)+tmp; q->data=tmp; - q->end=&q->data[new_size]; + q->end=q->data + new_size; } q->crt->tcp_conn=t; q->crt->unix_sock=unix_sock; diff --git a/src/core/usr_avp.c b/src/core/usr_avp.c index 96b877bafca..fc08cadc202 100644 --- a/src/core/usr_avp.c +++ b/src/core/usr_avp.c @@ -432,7 +432,10 @@ avp_t *search_avp (avp_ident_t ident, avp_value_t* val, struct search_state* sta break; } - if (!state) state = &st; + if (!state) { + memset(&st, 0, sizeof(struct search_state)); + state = &st; + } if ((ident.flags & AVP_CLASS_ALL) == 0) { /* The caller did not specify any class to search in, so enable @@ -455,16 +458,18 @@ avp_t *search_avp (avp_ident_t ident, avp_value_t* val, struct search_state* sta state->avp = *list; state->name = ident.name; - if (ident.flags & AVP_NAME_STR) { + if(ident.flags & AVP_NAME_STR) { state->id = compute_ID(&ident.name.s); } - ret = search_next_avp(state, val); + ret = search_next_avp(state, val); - /* Make sure that search next avp stays in the same class as the first - * avp found - */ - if (state && ret) state->flags = (ident.flags & ~AVP_CLASS_ALL) | (ret->flags & AVP_CLASS_ALL); + /* Make sure that search next avp stays in the same class as the first + * avp found */ + if(ret) { + state->flags = + (ident.flags & ~AVP_CLASS_ALL) | (ret->flags & AVP_CLASS_ALL); + } return ret; }