diff --git a/src/modules/db_text/dbt_raw_util.c b/src/modules/db_text/dbt_raw_util.c index 89fcc803a41..92b60287d61 100644 --- a/src/modules/db_text/dbt_raw_util.c +++ b/src/modules/db_text/dbt_raw_util.c @@ -206,8 +206,12 @@ int dbt_build_where(char* where, db_key_t** _k, db_op_t** _o, db_val_t** _v) memset(_v1, 0, sizeof(db_val_t) * MAX_CLAUSES); matches = (regmatch_t*)pkg_malloc(sizeof(regmatch_t) * MAX_MATCH); - if(matches==NULL) { + if(matches==NULL || _k1==NULL || _o1==NULL || _v1==NULL) { LM_ERR("error getting pkg memory\n"); + pkg_free(_k1); + pkg_free(_o1); + pkg_free(_v1); + pkg_free(matches); return -1; } diff --git a/src/modules/sipcapture/sipcapture.c b/src/modules/sipcapture/sipcapture.c index 1c365f81682..8fb9deb16b5 100644 --- a/src/modules/sipcapture/sipcapture.c +++ b/src/modules/sipcapture/sipcapture.c @@ -446,6 +446,7 @@ int parse_table_names (str table_name, str ** table_names){ names = (str*)pkg_malloc(sizeof(str) * no_tables); if(names == NULL) { LM_ERR("no more pkg memory left\n"); + pkg_free(table_name_cpy); return -1; } p = strtok (table_name_cpy,"| \t"); @@ -1887,7 +1888,7 @@ static int sip_capture(struct sip_msg *msg, str *_table, _capture_mode_data_t * else { EMPTY_STR(sco.custom1); } /* Custom - field2 */ - if(custom_field3_header.len > 0 && (tmphdr[5] = get_hdr_by_name(msg,custom_field2_header.s, custom_field2_header.len)) != NULL) { + if(custom_field2_header.len > 0 && (tmphdr[5] = get_hdr_by_name(msg,custom_field2_header.s, custom_field2_header.len)) != NULL) { sco.custom2 = tmphdr[5]->body; } else { EMPTY_STR(sco.custom2); } diff --git a/src/modules/sipt/sipt.c b/src/modules/sipt/sipt.c index d583ca0101a..f48de8d5ab6 100644 --- a/src/modules/sipt/sipt.c +++ b/src/modules/sipt/sipt.c @@ -440,7 +440,7 @@ int sipt_parse_pv_name(pv_spec_p sp, str *in) if(spv->sub_type == 0) { LM_ERR("Unknown SIPT subtype [%.*s]\n", pvsubtype.len, pvsubtype.s); - return -1; + goto error; } break; } @@ -450,7 +450,7 @@ int sipt_parse_pv_name(pv_spec_p sp, str *in) if(spv->type == 0) { LM_ERR("Unknown SIPT type [%.*s]\n",pvtype.len, pvtype.s); - return -1; + goto error; } sp->pvp.pvn.u.dname = (void*)spv; @@ -458,8 +458,9 @@ int sipt_parse_pv_name(pv_spec_p sp, str *in) return 0; error: - LM_ERR("error at PV sipt name: %.*s\n", in->len, in->s); - return -1; + LM_ERR("error at PV sipt name: %.*s\n", in->len, in->s); + pkg_free(spv); + return -1; } diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c index 987a20aed7d..1969384d418 100644 --- a/src/modules/siptrace/siptrace.c +++ b/src/modules/siptrace/siptrace.c @@ -1774,7 +1774,7 @@ static int trace_send_hep3_duplicate(str *body, str *from, str *to, struct dest_ HEP3_PACK_CHUNK_DATA (0, 0x0011, correlation_id_str->s, correlation_id_str->len); } } - if (auth_key_str.len) { + if (auth_key_str.s && auth_key_str.len > 0) { HEP3_PACK_CHUNK_DATA(0, 0x000e, auth_key_str.s, auth_key_str.len); } HEP3_PACK_CHUNK_DATA (0, 0x000f, body->s, body->len); @@ -2393,7 +2393,7 @@ static int hlog(struct sip_msg *msg, str *correlationid, str *message) { HEP3_PACK_CHUNK_UINT8 (0, 0x000b, 0x64); /* protocol type: log */ HEP3_PACK_CHUNK_UINT32(0, 0x000c, hep_capture_id); HEP3_PACK_CHUNK_DATA (0, 0x0011, correlationid->s, correlationid->len); - if (auth_key_str.len) { + if (auth_key_str.s && auth_key_str.len > 0) { HEP3_PACK_CHUNK_DATA(0, 0x000e, auth_key_str.s, auth_key_str.len); } HEP3_PACK_CHUNK_DATA (0, 0x000f, message->s, message->len);