Index: /issm/trunk-jpl/src/modules/Chaco/Chaco.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/Chaco/Chaco.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/Chaco/Chaco.cpp	(revision 12060)
@@ -18,18 +18,18 @@
 
 	/*Inputs: */
-	int       nvtxs;		/* number of vertices in graph */
-    int      *start;		/* start of edge list for each vertex */
-    int      *adjacency;	/* edge list data */
-    int      *vwgts=NULL;	/* weights for all vertices */
-	int       nedges;
-    float    *ewgts=NULL;	/* weights for all edges */
-    float    *x=NULL;
-    float    *y=NULL;
-    float    *z=NULL;		/* coordinates for inertial method */
-    double    options[10]={1,1,0,0,1,1,50,0,.001,7654321}; /* architecture and partitioning options */
-    double*   in_options=NULL;
-    int      *nparts=NULL;	/* number of parts options */
-	int       npart;
-    double   *goal=NULL;	/* desired set sizes */
+	int     nvtxs;               /* number of vertices in graph           */
+	int    *start;               /* start of edge list for each vertex    */
+	int    *adjacency;           /* edge list data                        */
+	int    *vwgts       = NULL;  /* weights for all vertices              */
+	int     nedges;
+	float  *ewgts       = NULL;  /* weights for all edges                 */
+	float  *x           = NULL;
+	float  *y           = NULL;
+	float  *z           = NULL;  /* coordinates for inertial method       */
+	double  options[10] = {1,1,0,0,1,1,50,0,.001,7654321}; /* architecture and partitioning options */
+	double *in_options  = NULL;
+	int    *nparts      = NULL;   /* number of parts options               */
+	int     npart;
+	double *goal        = NULL;   /* desired set sizes                     */
 
 	/*intermediary pointers: */
@@ -38,12 +38,10 @@
 
 	/*output: */
-    short    *assignment=NULL;	/* set number of each vtx (length nvtxs+1) */
-	double   *doubleassignment=NULL;	/*holds assignment, in double format, to return to matlab*/
-
+   short  *assignment       = NULL; /* set number of each vtx (length nvtxs+1)                */
+   double *doubleassignment = NULL; /*holds assignment, in double format, to return to matlab */
 
 	#ifndef _HAVE_CHACO_ //only works if dakota library has been compiled in.
 	_error_(" Chaco not available! Cannot carry out Chaco partitioning!");
 	#endif
-
 
 	/*Boot module: */
@@ -53,19 +51,17 @@
 	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ChacoUsage);
 
-
 	/*Fetch adjacency matrix: */
 	nvtxs = mxGetN(A_IN);
-
 	mwstart = mxGetJc(A_IN);
-	start=(int*)mxMalloc(nvtxs*sizeof(int));
+	start=(int*)xmalloc(nvtxs*sizeof(int));
 	for (i=0; i<nvtxs+1;i++)start[i]=(int)mwstart[i];
 
 	mwadjacency = mxGetIr(A_IN);
-	adjacency = (int*)mxMalloc(mxGetNzmax(A_IN)*sizeof(int));
+	adjacency = (int*)xmalloc(mxGetNzmax(A_IN)*sizeof(int));
 	for (i=0; i<mxGetNzmax(A_IN); i++) adjacency[i]= (int)mwadjacency[i];
 
 	nedges = start[nvtxs];
 	if(!mxIsEmpty(EWGTS_IN)){
-		ewgts = (float *) mxCalloc(nedges, sizeof(float));
+		ewgts = (float*)xcalloc(nedges, sizeof(float));
 		doublepointer=mxGetPr(A_IN);
 		for (i = 0; i < nedges; i++)ewgts[i] = (float)doublepointer[i];
@@ -75,15 +71,11 @@
 	/*Fetch rest of data: */
 	FetchData(&vwgts,&nterms,VWGTS_IN); 
-
 	FetchData(&x,&nterms,X_IN); 
 	FetchData(&y,&nterms,Y_IN); 
 	FetchData(&z,&nterms,Z_IN); 
-	
 	FetchData(&in_options,&nterms,OPTNS_IN); 
 	for (i=0;i<(nterms<10?nterms:10);i++) options[i]=in_options[i]; //copy in_options into default options
-	
 	FetchData(&npart,NPARTS_IN); 
-	nparts=(int*)mxMalloc(sizeof(int)); nparts[0]=npart; //weird Chacox interface ain't it?
-
+	nparts=(int*)xmalloc(sizeof(int)); nparts[0]=npart; //weird Chacox interface ain't it?
 	FetchData(&goal,&nterms,GOAL_IN); 
 	
@@ -112,5 +104,5 @@
 	
 	/*Allocate output: */
-	assignment = (short *) mxCalloc(nvtxs, sizeof(short));
+	assignment = (short*)xcalloc(nvtxs, sizeof(short));
 	
     /*Call core: */
@@ -118,6 +110,6 @@
 
     /*Output data: */
-	doubleassignment=(double*)mxMalloc(nvtxs*sizeof(double));
-	for (i=0;i<nvtxs;i++) doubleassignment[i]=(double)assignment[i];
+	doubleassignment=(double*)xmalloc(nvtxs*sizeof(double));
+	for(i=0;i<nvtxs;i++) doubleassignment[i]=(double)assignment[i];
 	WriteData(ASSGN_OUT,doubleassignment,nvtxs);
 
@@ -133,4 +125,5 @@
 	xfree((void**)&adjacency);
 	xfree((void**)&start);
+	xfree((void**)&doubleassignment);
 
 	/*end module: */
@@ -138,9 +131,7 @@
 }
 
-void ChacoUsage( void )
-{
+void ChacoUsage(void){
 	_printf_(true,"\n");
 	_printf_(true,"Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);\n");
 	_printf_(true,"\n");
 }
-
Index: /issm/trunk-jpl/src/modules/ContourToMesh/ContourToMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/ContourToMesh/ContourToMesh.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/ContourToMesh/ContourToMesh.cpp	(revision 12060)
@@ -26,21 +26,21 @@
 
 	/* required input: */
-	double* index=NULL;
-	double* x=NULL;
-	double* y=NULL;
 	int     edgevalue;
-	char*   interptype=NULL;
+	double *index      = NULL;
+	double *x          = NULL;
+	double *y          = NULL;
+	char   *interptype = NULL;
 
 	/* output: */
-	Vector*  in_nod=NULL;
-	int  nods;
-	Vector*  in_elem=NULL;
-	int  nel;
+	Vector *in_nod  = NULL;
+	int     nods;
+	Vector *in_elem = NULL;
+	int     nel;
 
 	//contours
-	mxArray*  matlabstructure=NULL;
-	int numcontours;
-	Contour** contours=NULL;
-	Contour*  contouri=NULL;
+	mxArray  *matlabstructure = NULL;
+	int       numcontours;
+	Contour **contours        = NULL;
+	Contour  *contouri        = NULL;
 
 	/*Boot module: */
@@ -65,8 +65,8 @@
 	//Fetch contours
 	numcontours=mxGetNumberOfElements(matlabstructure);
-	contours=(Contour**)mxMalloc(numcontours*sizeof(Contour*));
+	contours=(Contour**)xmalloc(numcontours*sizeof(Contour*));
 	for(i=0;i<numcontours;i++){
 		//allocate
-		contouri=(Contour*)mxMalloc(sizeof(Contour));
+		contouri=(Contour*)xmalloc(sizeof(Contour));
 		//retrieve dimension of this contour.
 		contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
Index: /issm/trunk-jpl/src/modules/ContourToNodes/ContourToNodes.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/ContourToNodes/ContourToNodes.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/ContourToNodes/ContourToNodes.cpp	(revision 12060)
@@ -68,8 +68,8 @@
 
 	numcontours=mxGetNumberOfElements(matlabstructure);
-	contours=(Contour**)mxMalloc(numcontours*sizeof(Contour*));
+	contours=(Contour**)xmalloc(numcontours*sizeof(Contour*));
 	for(i=0;i<numcontours;i++){
 		//allocate
-		contouri=(Contour*)mxMalloc(sizeof(Contour));
+		contouri=(Contour*)xmalloc(sizeof(Contour));
 		//retrieve dimension of this contour.
 		contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
Index: /issm/trunk-jpl/src/modules/InternalFront/InternalFront.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/InternalFront/InternalFront.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/InternalFront/InternalFront.cpp	(revision 12060)
@@ -36,5 +36,5 @@
 	/*Allocate and initialize all variables*/
 	numberofsegments=0;
-	front=(int*)mxMalloc(3*numberofelements*4*sizeof(int));
+	front=(int*)xmalloc(3*numberofelements*4*sizeof(int));
 
 	/*Loop over all elements on water*/
@@ -81,5 +81,5 @@
 	/*Now that we know how many segments there is we can allocate the final matrix*/
 	if(numberofsegments){
-		front2=(double*)mxMalloc(4*numberofsegments*sizeof(double));
+		front2=(double*)xmalloc(4*numberofsegments*sizeof(double));
 		for(i=0;i<4*numberofsegments;i++) front2[i]=(double)front[i];
 	}
Index: /issm/trunk-jpl/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 12060)
@@ -100,8 +100,8 @@
 		/*contours: */
 		numcontours=mxGetNumberOfElements(matlabstructure);
-		contours=(Contour**)mxMalloc(numcontours*sizeof(Contour*));
+		contours=(Contour**)xmalloc(numcontours*sizeof(Contour*));
 		for(i=0;i<numcontours;i++){
 			//allocate
-			contouri=(Contour*)mxMalloc(sizeof(Contour));
+			contouri=(Contour*)xmalloc(sizeof(Contour));
 			//retrieve dimension of this contour.
 			contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
Index: /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 12060)
@@ -78,8 +78,8 @@
 		/*contours: */
 		numcontours=mxGetNumberOfElements(matlabstructure);
-		contours=(Contour**)mxMalloc(numcontours*sizeof(Contour*));
+		contours=(Contour**)xmalloc(numcontours*sizeof(Contour*));
 		for(i=0;i<numcontours;i++){
 			//allocate
-			contouri=(Contour*)mxMalloc(sizeof(Contour));
+			contouri=(Contour*)xmalloc(sizeof(Contour));
 			//retrieve dimension of this contour.
 			contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
Index: /issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp	(revision 12060)
@@ -55,10 +55,10 @@
 			if (notesi && mxIsChar(notesi) && mxGetNumberOfElements(notesi)) {
 				if (!notes) {
-					notes=(char *) mxMalloc((mxGetNumberOfElements(notesi)+1)*sizeof(char));
+					notes=(char *) xmalloc((mxGetNumberOfElements(notesi)+1)*sizeof(char));
 					mxGetString(notesi,notes,mxGetNumberOfElements(notesi)+1);
 				}
 				else {
 /*  note that strlen does not include trailing null  */
-					notes=(char *) mxRealloc(notes,(strlen(notes)+1+mxGetNumberOfElements(notesi)+1)*sizeof(char));
+					notes=(char*)xrealloc(notes,(strlen(notes)+1+mxGetNumberOfElements(notesi)+1)*sizeof(char));
 					strcat(notes,"\n");
 					mxGetString(notesi,&notes[strlen(notes)],mxGetNumberOfElements(notesi)+1);
Index: /issm/trunk-jpl/src/modules/MeshPartition/MeshPartition.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/MeshPartition/MeshPartition.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/MeshPartition/MeshPartition.cpp	(revision 12060)
@@ -74,10 +74,10 @@
 
 	/*Post process node_partitioning and element_partitioning to be in double format. Metis needed them in int* format: */
-	element_partitioning=(double*)mxMalloc(numberofelements*sizeof(double));
+	element_partitioning=(double*)xmalloc(numberofelements*sizeof(double));
 	for (i=0;i<numberofelements;i++){
 		element_partitioning[i]=(double)int_element_partitioning[i]+1; //Metis indexing from 0, matlab from 1.
 	}
 	
-	node_partitioning=(double*)mxMalloc(numberofvertices*sizeof(double));
+	node_partitioning=(double*)xmalloc(numberofvertices*sizeof(double));
 	for (i=0;i<numberofvertices;i++){
 		node_partitioning[i]=(double)int_node_partitioning[i]+1; //Metis indexing from 0, matlab from 1.
Index: /issm/trunk-jpl/src/modules/MeshProfileIntersection/MeshProfileIntersection.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 12060)
@@ -55,5 +55,5 @@
 	FetchData(&double_index,&nel,&dummy,INDEX);
 	if(dummy!=3 && dummy!=6)_error_(" element triangulation should be of 3 or 6 column width!");
-	index=(int*)mxMalloc(nel*3*sizeof(int));
+	index=(int*)xmalloc(nel*3*sizeof(int));
 	for(i=0;i<nel;i++){
 		for(j=0;j<3;j++){
@@ -67,8 +67,8 @@
 	//contours
 	numcontours=mxGetNumberOfElements(matlabstructure);
-	contours=(Contour**)mxMalloc(numcontours*sizeof(Contour*));
+	contours=(Contour**)xmalloc(numcontours*sizeof(Contour*));
 	for(i=0;i<numcontours;i++){
 		//allocate
-		contouri=(Contour*)mxMalloc(sizeof(Contour));
+		contouri=(Contour*)xmalloc(sizeof(Contour));
 		//retrieve dimension of this contour.
 		contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
Index: /issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp	(revision 12060)
@@ -74,5 +74,5 @@
 		nel=mxGetM(prhs[0]);
 		tindex_in=mxGetPr(prhs[0]);
-		index_in=(double*)mxMalloc(nel*3*sizeof(double));
+		index_in=(double*)xmalloc(nel*3*sizeof(double));
 		for (i=0;i<nel;i++){
 			for (j=0;j<3;j++){
@@ -90,5 +90,5 @@
 		nods=mxGetM(prhs[1]);
 		x_inm=mxGetPr(prhs[1]);
-		x_in=(double*)mxMalloc(nods*sizeof(double));
+		x_in=(double*)xmalloc(nods*sizeof(double));
 		for (i=0;i<nods;i++){
 			x_in[i]=x_inm[i];
@@ -103,5 +103,5 @@
 	if(mxIsDouble(prhs[2])){
 		y_inm=mxGetPr(prhs[2]);
-		y_in=(double*)mxMalloc(nods*sizeof(double));
+		y_in=(double*)xmalloc(nods*sizeof(double));
 		for (i=0;i<nods;i++){
 			y_in[i]=y_inm[i];
@@ -117,5 +117,5 @@
 		num_seg=mxGetM(prhs[3]);
 		tsegments_in=mxGetPr(prhs[3]);
-		segments_in=(double*)mxMalloc(num_seg*3*sizeof(double));
+		segments_in=(double*)xmalloc(num_seg*3*sizeof(double));
 		for (i=0;i<num_seg;i++){
 			for (j=0;j<3;j++){
@@ -132,5 +132,5 @@
 	if(mxIsDouble(prhs[4])){
 		tsegmentmarkers_in=mxGetPr(prhs[4]);
-		segmentmarkers_in=(double*)mxMalloc(num_seg*sizeof(double));
+		segmentmarkers_in=(double*)xmalloc(num_seg*sizeof(double));
 		for (i=0;i<num_seg;i++){
 			segmentmarkers_in[i]=tsegmentmarkers_in[i];
@@ -270,5 +270,5 @@
 			pmxa_array2= mxCreateDoubleMatrix(0,0,mxREAL);
 			mxSetM(pmxa_array2,1);
-			pair=(double*)mxMalloc(2*sizeof(double));
+			pair=(double*)xmalloc(2*sizeof(double));
 			pair[0]=*(out_riftstips+2*i+0);
 			pair[1]=*(out_riftstips+2*i+1);
@@ -293,5 +293,5 @@
 
 			/*State: */
-			state=(double*)mxMalloc(out_riftsnumpenaltypairs[i]*sizeof(double));
+			state=(double*)xmalloc(out_riftsnumpenaltypairs[i]*sizeof(double));
 			for(j=0;j<out_riftsnumpenaltypairs[i];j++)state[j]=FreeEnum;
 			pmxa_array2= mxCreateDoubleMatrix(0,0,mxREAL);
@@ -306,5 +306,5 @@
 	else{
 		/*output NaN :*/
-		pNaN=(double*)mxMalloc(sizeof(double));
+		pNaN=(double*)xmalloc(sizeof(double));
 		*pNaN=NAN;
 		pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
Index: /issm/trunk-jpl/src/modules/TriMeshRefine/TriMeshRefine.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/TriMeshRefine/TriMeshRefine.cpp	(revision 12059)
+++ /issm/trunk-jpl/src/modules/TriMeshRefine/TriMeshRefine.cpp	(revision 12060)
@@ -65,5 +65,5 @@
 		nel=mxGetM(prhs[0]);
 		tindex_in=mxGetPr(prhs[0]);
-		index_in=(double*)mxMalloc(nel*3*sizeof(double));
+		index_in=(double*)xmalloc(nel*3*sizeof(double));
 		for (i=0;i<nel;i++){
 			for (j=0;j<3;j++){
@@ -81,5 +81,5 @@
 		nods=mxGetM(prhs[1]);
 		x_inm=mxGetPr(prhs[1]);
-		x_in=(double*)mxMalloc(nods*sizeof(double));
+		x_in=(double*)xmalloc(nods*sizeof(double));
 		for (i=0;i<nods;i++){
 			x_in[i]=x_inm[i];
@@ -94,5 +94,5 @@
 	if(mxIsDouble(prhs[2])){
 		y_inm=mxGetPr(prhs[2]);
-		y_in=(double*)mxMalloc(nods*sizeof(double));
+		y_in=(double*)xmalloc(nods*sizeof(double));
 		for (i=0;i<nods;i++){
 			y_in[i]=y_inm[i];
@@ -108,5 +108,5 @@
 		num_seg=mxGetM(prhs[3]);
 		tsegments_in=mxGetPr(prhs[3]);
-		segments_in=(double*)mxMalloc(num_seg*3*sizeof(double));
+		segments_in=(double*)xmalloc(num_seg*3*sizeof(double));
 		for (i=0;i<num_seg;i++){
 			for (j=0;j<3;j++){
@@ -123,5 +123,5 @@
 	if(mxIsDouble(prhs[4])){
 		tsegmentmarkers_in=mxGetPr(prhs[4]);
-		segmentmarkers_in=(double*)mxMalloc(num_seg*sizeof(double));
+		segmentmarkers_in=(double*)xmalloc(num_seg*sizeof(double));
 		for (i=0;i<num_seg;i++){
 			segmentmarkers_in[i]=tsegmentmarkers_in[i];
@@ -152,5 +152,5 @@
 			mexErrMsgTxt(" ");
 		}
-		order = (char *) mxMalloc((mxGetN(prhs[6])+1)*sizeof(char));
+		order = (char *) xmalloc((mxGetN(prhs[6])+1)*sizeof(char));
 		mxGetString(prhs[6],order,mxGetN(prhs[6])+1);
 	}
@@ -186,5 +186,5 @@
 	in.numberofcorners=3;
 	
-	in.trianglelist = (int *) mxMalloc(3*in.numberoftriangles * sizeof(int));
+	in.trianglelist = (int *) xmalloc(3*in.numberoftriangles * sizeof(int));
 	for(i=0;i<in.numberoftriangles;i++){
 		for(j=0;j<3;j++){
@@ -192,9 +192,9 @@
 		}
 	}
-	in.triangleattributelist = (REAL *) mxMalloc(in.numberoftriangles * in.numberoftriangleattributes * sizeof(REAL));
+	in.triangleattributelist = (REAL *) xmalloc(in.numberoftriangles * in.numberoftriangleattributes * sizeof(REAL));
 	for(i=0;i<in.numberoftriangles;i++){
 		in.triangleattributelist[i]=0.0;
 	}
-	in.trianglearealist = (REAL *) mxMalloc(in.numberoftriangles * sizeof(REAL));
+	in.trianglearealist = (REAL *) xmalloc(in.numberoftriangles * sizeof(REAL));
 	for(i=0;i<in.numberoftriangles;i++){
 		in.trianglearealist[i]=area[i];
@@ -203,10 +203,10 @@
 	in.numberofpoints=nods;
 	in.numberofpointattributes=1;
-	in.pointlist = (REAL *) mxMalloc(in.numberofpoints * 2 * sizeof(REAL));
+	in.pointlist = (REAL *) xmalloc(in.numberofpoints * 2 * sizeof(REAL));
 	for (i=0;i<nods;i++){
 		in.pointlist[2*i+0]=x_in[i];
 		in.pointlist[2*i+1]=y_in[i];
 	}
-	in.pointattributelist = (REAL *) mxMalloc(in.numberofpoints * in.numberofpointattributes * sizeof(REAL));
+	in.pointattributelist = (REAL *) xmalloc(in.numberofpoints * in.numberofpointattributes * sizeof(REAL));
 	for (i=0;i<nods;i++){
 		in.pointattributelist[i] = 0.0;
@@ -214,5 +214,5 @@
 
 	in.numberofsegments = num_seg;
-	in.segmentlist = (int *) mxMalloc(in.numberofsegments * 2 * sizeof(REAL));
+	in.segmentlist = (int *) xmalloc(in.numberofsegments * 2 * sizeof(REAL));
 	in.segmentmarkerlist = (int *) mxCalloc(in.numberofsegments,sizeof(int));
 	for (i=0;i<num_seg;i++){
@@ -250,9 +250,9 @@
 	
 	/*Allocate index, x and y: */
-	index=(double*)mxMalloc(3*out.numberoftriangles*sizeof(double));
-	x=(double*)mxMalloc(out.numberofpoints*sizeof(double));
-	y=(double*)mxMalloc(out.numberofpoints*sizeof(double));
-	segments=(double*)mxMalloc(3*out.numberofsegments*sizeof(double));
-	segmentmarkerlist=(double*)mxMalloc(out.numberofsegments*sizeof(double));
+	index=(double*)xmalloc(3*out.numberoftriangles*sizeof(double));
+	x=(double*)xmalloc(out.numberofpoints*sizeof(double));
+	y=(double*)xmalloc(out.numberofpoints*sizeof(double));
+	segments=(double*)xmalloc(3*out.numberofsegments*sizeof(double));
+	segmentmarkerlist=(double*)xmalloc(out.numberofsegments*sizeof(double));
 
 	for (i = 0; i < out.numberoftriangles; i++) {
