Browse code

core: proper cloning of xavp list with no-data type

- function used for cloning xavps stored in location record
- reported by Luca Mularoni

Daniel-Constantin Mierla authored on 14/07/2015 12:54:31
Showing 1 changed files
... ...
@@ -641,6 +641,7 @@ sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
641 641
 		LM_ERR("cannot create cloned root xavp\n");
642 642
 		return NULL;
643 643
 	}
644
+	LM_DBG("cloned root xavp [%.*s]\n", xold->name.len, xold->name.s);
644 645
 
645 646
 	if(xold->val.type!=SR_XTYPE_XAVP)
646 647
 	{
... ...
@@ -667,15 +668,16 @@ sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
667 667
 					return NULL;
668 668
 				}
669 669
 			}
670
+			LM_DBG("cloned inner xavp [%.*s]\n", oavp->name.len, oavp->name.s);
670 671
 			if(xnew->val.v.xavp == NULL)
671 672
 			{
672 673
 				/* link to val in head xavp */
673 674
 				xnew->val.v.xavp = navp;
674
-				pavp = navp;
675 675
 			} else {
676 676
 				/* link to prev xavp in the list */
677 677
 				pavp->next = navp;
678 678
 			}
679
+			pavp = navp;
679 680
 		}
680 681
 		oavp = oavp->next;
681 682
 	}