Module: kamailio Branch: master Commit: adc4493fa6861895bdcf8b459e5fbc76e80d0f1f URL: https://github.com/kamailio/kamailio/commit/adc4493fa6861895bdcf8b459e5fbc76...
Author: lazedo luis.azedo@factorlusitano.com Committer: Henning Westerholt henningw@users.noreply.github.com Date: 2019-02-11T22:04:58+01:00
registrar : check xavp clone result
---
Modified: src/modules/registrar/lookup.c
---
Diff: https://github.com/kamailio/kamailio/commit/adc4493fa6861895bdcf8b459e5fbc76... Patch: https://github.com/kamailio/kamailio/commit/adc4493fa6861895bdcf8b459e5fbc76...
---
diff --git a/src/modules/registrar/lookup.c b/src/modules/registrar/lookup.c index 84c0f40208..f012d690ab 100644 --- a/src/modules/registrar/lookup.c +++ b/src/modules/registrar/lookup.c @@ -394,7 +394,15 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)
if(ptr->xavp!=NULL) { xavp = xavp_clone_level_nodata(ptr->xavp); - if(xavp_insert(xavp, 0, NULL)<0) { + if(xavp != NULL) { + if(xavp_insert(xavp, 0, NULL)<0) { + LM_ERR("error inserting xavp after clone\n"); + xavp_destroy_list(&xavp); + ret = -3; + goto done; + } + } else { + LM_ERR("error cloning xavp\n"); ret = -3; goto done; } @@ -461,7 +469,15 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode) } if(ptr->xavp!=NULL) { xavp = xavp_clone_level_nodata(ptr->xavp); - if(xavp_insert(xavp, nr_branches, NULL)<0) { + if(xavp != NULL) { + if(xavp_insert(xavp, nr_branches, NULL)<0) { + LM_ERR("error inserting xavp after clone\n"); + xavp_destroy_list(&xavp); + ret = -3; + goto done; + } + } else { + LM_ERR("error cloning xavp\n"); ret = -3; goto done; } @@ -784,10 +800,15 @@ int registered4(struct sip_msg* _m, udomain_t* _d, str* _uri, int match_flag,
if((ptr->xavp!=NULL) && (match_action_flag & 1)) { sr_xavp_t *xavp = xavp_clone_level_nodata(ptr->xavp); - if(xavp_add(xavp, NULL)<0) { - LM_ERR("error adding xavp for %.*s after successful match\n", + if(xavp != NULL) { + if(xavp_add(xavp, NULL)<0) { + LM_ERR("error adding xavp for %.*s after successful match\n", + aor.len, ZSW(aor.s)); + xavp_destroy_list(&xavp); + } + } else { + LM_ERR("error cloning xavp for %.*s after successful match\n", aor.len, ZSW(aor.s)); - xavp_destroy_list(&xavp); } }