Module: kamailio
Branch: 5.1
Commit: 878c23cbef8d0d32035ed4f438c61da7a5ffc815
URL:
https://github.com/kamailio/kamailio/commit/878c23cbef8d0d32035ed4f438c61da…
Author: lazedo <luis.azedo(a)factorlusitano.com>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2019-02-12T09:52:19+01:00
registrar : check xavp clone result
(cherry picked from commit adc4493fa6861895bdcf8b459e5fbc76e80d0f1f)
---
Modified: src/modules/registrar/lookup.c
---
Diff:
https://github.com/kamailio/kamailio/commit/878c23cbef8d0d32035ed4f438c61da…
Patch:
https://github.com/kamailio/kamailio/commit/878c23cbef8d0d32035ed4f438c61da…
---
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);
}
}