ソースを参照

registrar: more debug messages when adding ruid xavp

- free local ruid xavp if cannot be added to root list
Daniel-Constantin Mierla 12 年 前
コミット
9589466916
1 ファイル変更8 行追加3 行削除
  1. 8 3
      modules/registrar/reply.c

+ 8 - 3
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));
 				memset(&xval, 0, sizeof(sr_xval_t));
 				xval.type = SR_XTYPE_STR;
 				xval.type = SR_XTYPE_STR;
 				xval.v.s = c->ruid;
 				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, ...) */
 	/* add xavp with details of the record (ruid, ...) */
 	if(reg_xavp_rcd.s!=NULL)
 	if(reg_xavp_rcd.s!=NULL)
 	{
 	{
-		if(list==NULL)
+		if(list==NULL && xavp!=NULL)
 		{
 		{
 			/* no reg_xavp_rcd xavp in root list - add it */
 			/* no reg_xavp_rcd xavp in root list - add it */
 			xval.type = SR_XTYPE_XAVP;
 			xval.type = SR_XTYPE_XAVP;
 			xval.v.xavp = 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);
+			}
 		}
 		}
 	}
 	}