[sr-dev] git:master: registrar: more debug messages when adding ruid xavp

Daniel-Constantin Mierla miconda at gmail.com
Tue Jun 11 18:41:28 CEST 2013


Module: sip-router
Branch: master
Commit: 9589466916305146fb4f982542c3f3a51126dcef
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9589466916305146fb4f982542c3f3a51126dcef

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Jun 11 18:37:32 2013 +0200

registrar: more debug messages when adding ruid xavp

- free local ruid xavp if cannot be added to root list

---

 modules/registrar/reply.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/registrar/reply.c b/modules/registrar/reply.c
index b692ef0..28588fa 100644
--- a/modules/registrar/reply.c
+++ b/modules/registrar/reply.c
@@ -342,7 +342,9 @@ int build_contact(sip_msg_t *msg, ucontact_t* c, str *host)
 				memset(&xval, 0, sizeof(sr_xval_t));
 				xval.type = SR_XTYPE_STR;
 				xval.v.s = c->ruid;
-				xavp_add_value(&xname, &xval, &xavp);
+				if(xavp_add_value(&xname, &xval, &xavp)==NULL) {
+					LM_ERR("cannot add ruid value to xavp\n");
+				}
 			}
 		}
 
@@ -352,12 +354,15 @@ int build_contact(sip_msg_t *msg, ucontact_t* c, str *host)
 	/* add xavp with details of the record (ruid, ...) */
 	if(reg_xavp_rcd.s!=NULL)
 	{
-		if(list==NULL)
+		if(list==NULL && xavp!=NULL)
 		{
 			/* no reg_xavp_rcd xavp in root list - add it */
 			xval.type = SR_XTYPE_XAVP;
 			xval.v.xavp = xavp;
-			xavp_add_value(&reg_xavp_rcd, &xval, NULL);
+			if(xavp_add_value(&reg_xavp_rcd, &xval, NULL)==NULL) {
+				LM_ERR("cannot add ruid xavp to root list\n");
+				xavp_destroy_list(&xavp);
+			}
 		}
 	}
 




More information about the sr-dev mailing list