Browse code

registrar: more debug messages when adding ruid xavp

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

Daniel-Constantin Mierla authored on 11/06/2013 16:37:32
Showing 1 changed files
... ...
@@ -342,7 +342,9 @@ int build_contact(sip_msg_t *msg, ucontact_t* c, str *host)
342 342
 				memset(&xval, 0, sizeof(sr_xval_t));
343 343
 				xval.type = SR_XTYPE_STR;
344 344
 				xval.v.s = c->ruid;
345
-				xavp_add_value(&xname, &xval, &xavp);
345
+				if(xavp_add_value(&xname, &xval, &xavp)==NULL) {
346
+					LM_ERR("cannot add ruid value to xavp\n");
347
+				}
346 348
 			}
347 349
 		}
348 350
 
... ...
@@ -352,12 +354,15 @@ int build_contact(sip_msg_t *msg, ucontact_t* c, str *host)
352 354
 	/* add xavp with details of the record (ruid, ...) */
353 355
 	if(reg_xavp_rcd.s!=NULL)
354 356
 	{
355
-		if(list==NULL)
357
+		if(list==NULL && xavp!=NULL)
356 358
 		{
357 359
 			/* no reg_xavp_rcd xavp in root list - add it */
358 360
 			xval.type = SR_XTYPE_XAVP;
359 361
 			xval.v.xavp = xavp;
360
-			xavp_add_value(&reg_xavp_rcd, &xval, NULL);
362
+			if(xavp_add_value(&reg_xavp_rcd, &xval, NULL)==NULL) {
363
+				LM_ERR("cannot add ruid xavp to root list\n");
364
+				xavp_destroy_list(&xavp);
365
+			}
361 366
 		}
362 367
 	}
363 368