Module: kamailio Branch: master Commit: 5633026f90e46f7d6da8c1a658d425e8926f6949 URL: https://github.com/kamailio/kamailio/commit/5633026f90e46f7d6da8c1a658d425e8...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2023-08-23T10:55:35+02:00
pv_headers: compare result of pvh_set_xavi() with NULL for error cases
- the function returns a pointer
---
Modified: src/modules/pv_headers/pvh_xavp.c
---
Diff: https://github.com/kamailio/kamailio/commit/5633026f90e46f7d6da8c1a658d425e8... Patch: https://github.com/kamailio/kamailio/commit/5633026f90e46f7d6da8c1a658d425e8...
---
diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c index b772262691d..441a2a664af 100644 --- a/src/modules/pv_headers/pvh_xavp.c +++ b/src/modules/pv_headers/pvh_xavp.c @@ -619,11 +619,11 @@ int pvh_set_header( xavi->name.len, xavi->name.s, hname->len, hname->s); } if(pvh_set_xavi(msg, &xavi_name, hname, NULL, SR_XTYPE_NULL, 0, 0) - < 0) + == NULL) goto err; } else { if(pvh_set_xavi(msg, &xavi_name, hname, NULL, SR_XTYPE_NULL, idx, 0) - < 0) + == NULL) goto err; } } else if(val->flags & (PV_VAL_STR | PV_TYPE_INT | PV_VAL_INT)) { @@ -642,7 +642,7 @@ int pvh_set_header( } if(idx == 0 && idxf == PV_IDX_NONE) { if(pvh_set_xavi(msg, &xavi_name, hname, &fval, SR_XTYPE_STR, 0, 1) - < 0) + == NULL) goto err; } else if(idxf == PV_IDX_ALL) { if(hname_cnt > 1) { @@ -652,11 +652,11 @@ int pvh_set_header( } if(pvh_set_xavi(msg, &xavi_name, hname, &fval, SR_XTYPE_STR, 0, hname_cnt ? 0 : 1) - < 0) + == NULL) goto err; } else { if(pvh_set_xavi(msg, &xavi_name, hname, &fval, SR_XTYPE_STR, idx, 0) - < 0) + == NULL) goto err; } if(pv_format) @@ -694,7 +694,7 @@ xavp_c_data_t *pvh_set_parsed( if(pvh_merge_uri(msg, SET_URI_T, cur, val, c_data) < 0) goto err; if(pvh_set_xavi(msg, &xavi_parsed_xname, hname, c_data, SR_XTYPE_DATA, 0, 0) - < 0) + == NULL) goto err; LM_DBG("c_data from pvh_merge_uri hname:%.*s\n", hname->len, hname->s);
@@ -857,12 +857,12 @@ int pvh_set_uri(struct sip_msg *msg, pv_param_t *param, int op, pv_value_t *val) /* LM_DBG("xavi:%.*s hname:%.*s value:%.*s\n", xavi_name.len, xavi_name.s, hname.len, hname.s, c_data->value.len, c_data->value.s); */ if(pvh_set_xavi(msg, &xavi_name, &hname, &c_data->value, SR_XTYPE_STR, 0, 0) - < 0) + == NULL) goto err;
if(pvh_set_xavi( msg, &xavi_parsed_xname, &hname, c_data, SR_XTYPE_DATA, 0, 0) - < 0) + == NULL) goto err;
if(pv_format) @@ -1127,7 +1127,7 @@ int pvh_set_reply_sr( case 2: // reason if(pvh_set_xavi(msg, &xavi_name, &_hdr_reply_reason, &fval, SR_XTYPE_STR, 0, 0) - < 0) { + == NULL) { LM_ERR("set reply: cannot set reply reason\n"); goto err; }