From: Daniel-Constantin Mierla Date: Wed, 23 Aug 2023 10:55:35 +0200 Subject: pv_headers: compare result of pvh_set_xavi() with NULL for error cases - the function returns a pointer --- src/modules/pv_headers/pvh_xavp.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c index 6f63015..3bc32d2 100644 --- a/src/modules/pv_headers/pvh_xavp.c +++ b/src/modules/pv_headers/pvh_xavp.c @@ -618,11 +618,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)) { @@ -641,7 +641,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) { @@ -651,11 +651,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) @@ -693,7 +693,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); @@ -856,12 +856,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) @@ -1126,7 +1126,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; }