Index: /issm/trunk-jpl/src/c/objects/Gauss/GaussPenta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Gauss/GaussPenta.cpp	(revision 12454)
+++ /issm/trunk-jpl/src/c/objects/Gauss/GaussPenta.cpp	(revision 12455)
@@ -47,9 +47,9 @@
 	/*Allocate GaussPenta fields*/
 	numgauss=numgauss_horiz*numgauss_vert;
-	coords1=(double*)xmalloc(numgauss*sizeof(double));
-	coords2=(double*)xmalloc(numgauss*sizeof(double));
-	coords3=(double*)xmalloc(numgauss*sizeof(double));
-	coords4=(double*)xmalloc(numgauss*sizeof(double));
-	weights=(double*)xmalloc(numgauss*sizeof(double));
+	coords1=xNew<double>(numgauss);
+	coords2=xNew<double>(numgauss);
+	coords3=xNew<double>(numgauss);
+	coords4=xNew<double>(numgauss);
+	weights=xNew<double>(numgauss);
 
 	/*Combine Horizontal and vertical points*/
@@ -72,10 +72,10 @@
 
 	/*Clean up*/
-	xfree((void**)&coords1_horiz);
-	xfree((void**)&coords2_horiz);
-	xfree((void**)&coords3_horiz);
-	xfree((void**)&coords_vert);
-	xfree((void**)&weights_horiz);
-	xfree((void**)&weights_vert);
+	xDelete<double>(coords1_horiz);
+	xDelete<double>(coords2_horiz);
+	xDelete<double>(coords3_horiz);
+	xDelete<double>(coords_vert);
+	xDelete<double>(weights_horiz);
+	xDelete<double>(weights_vert);
 }
 /*}}}*/
@@ -93,9 +93,9 @@
 
 	/*Allocate GaussPenta fields*/
-	coords1=(double*)xmalloc(numgauss*sizeof(double));
-	coords2=(double*)xmalloc(numgauss*sizeof(double));
-	coords3=(double*)xmalloc(numgauss*sizeof(double));
-	coords4=(double*)xmalloc(numgauss*sizeof(double));
-	weights=(double*)xmalloc(numgauss*sizeof(double));
+	coords1=xNew<double>(numgauss);
+	coords2=xNew<double>(numgauss);
+	coords3=xNew<double>(numgauss);
+	coords4=xNew<double>(numgauss);
+	weights=xNew<double>(numgauss);
 
 	if(index1==0 && index2==3){
@@ -132,6 +132,6 @@
 
 	/*clean up*/
-	xfree((void**)&seg_coords);
-	xfree((void**)&seg_weights);
+	xDelete<double>(seg_coords);
+	xDelete<double>(seg_weights);
 
 }
@@ -147,5 +147,5 @@
 
 		/*compute z coordinate*/
-		coords4=(double*)xmalloc(numgauss*sizeof(double));
+		coords4=xNew<double>(numgauss);
 		for(int i=0;i<numgauss;i++) coords4[i]=-1.0;
 	}
@@ -157,5 +157,5 @@
 
 		/*compute z coordinate*/
-		coords4=(double*)xmalloc(numgauss*sizeof(double));
+		coords4=xNew<double>(numgauss);
 		for(int i=0;i<numgauss;i++) coords4[i]=1.0;
 	}
@@ -182,9 +182,9 @@
 	/*Allocate GaussPenta fields*/
 	numgauss=order_horiz*order_vert;
-	coords1=(double*)xmalloc(numgauss*sizeof(double));
-	coords2=(double*)xmalloc(numgauss*sizeof(double));
-	coords3=(double*)xmalloc(numgauss*sizeof(double));
-	coords4=(double*)xmalloc(numgauss*sizeof(double));
-	weights=(double*)xmalloc(numgauss*sizeof(double));
+	coords1=xNew<double>(numgauss);
+	coords2=xNew<double>(numgauss);
+	coords3=xNew<double>(numgauss);
+	coords4=xNew<double>(numgauss);
+	weights=xNew<double>(numgauss);
 
 	/*Quads: get the gauss points using the product of two line rules  */
@@ -227,17 +227,17 @@
 
 	/*clean-up*/
-	xfree((void**)&seg_horiz_coords);
-	xfree((void**)&seg_horiz_weights);
-	xfree((void**)&seg_vert_coords);
-	xfree((void**)&seg_vert_weights);
+	xDelete<double>(seg_horiz_coords);
+	xDelete<double>(seg_horiz_weights);
+	xDelete<double>(seg_vert_coords);
+	xDelete<double>(seg_vert_weights);
 }
 /*}}}*/
 /*FUNCTION GaussPenta::~GaussPenta(){{{*/
 GaussPenta::~GaussPenta(){
-	xfree((void**)&weights);
-	xfree((void**)&coords1);
-	xfree((void**)&coords2);
-	xfree((void**)&coords3);
-	xfree((void**)&coords4);
+	xDelete<double>(weights);
+	xDelete<double>(coords1);
+	xDelete<double>(coords2);
+	xDelete<double>(coords3);
+	xDelete<double>(coords4);
 }
 /*}}}*/
@@ -357,5 +357,5 @@
 	if(index1==0 && index2==1 && index3==2){
 		GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order);
-		coords4=(double*)xmalloc(numgauss*sizeof(double));
+		coords4=xNew<double>(numgauss);
 		for(int i=0;i<numgauss;i++) coords4[i]=-1.0;
 	}
Index: /issm/trunk-jpl/src/c/objects/Gauss/GaussTria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Gauss/GaussTria.cpp	(revision 12454)
+++ /issm/trunk-jpl/src/c/objects/Gauss/GaussTria.cpp	(revision 12455)
@@ -91,6 +91,6 @@
 
 	/*clean up*/
-	xfree((void**)&seg_coords);
-	xfree((void**)&seg_weights);
+	xDelete<double>(seg_coords);
+	xDelete<double>(seg_weights);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/objects/Inputs/TransientInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Inputs/TransientInput.cpp	(revision 12454)
+++ /issm/trunk-jpl/src/c/objects/Inputs/TransientInput.cpp	(revision 12455)
@@ -46,5 +46,5 @@
 /*FUNCTION TransientInput::~TransientInput{{{*/
 TransientInput::~TransientInput(){
-	xfree((void**)&this->timesteps);
+	xDelete<double>(this->timesteps);
 	this->timesteps=NULL;
 	this->numtimesteps=0;
@@ -100,5 +100,5 @@
 	output->enum_type=this->enum_type;
 	output->numtimesteps=this->numtimesteps;
-	output->timesteps=(IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));
+	output->timesteps=xNew<IssmPDouble>(this->numtimesteps);
    memcpy(output->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmPDouble));
 	output->inputs=(Inputs*)this->inputs->Copy();
@@ -128,5 +128,5 @@
 	outinput->enum_type=this->enum_type;
 	outinput->numtimesteps=this->numtimesteps;
-	outinput->timesteps=(IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));
+	outinput->timesteps=xNew<IssmPDouble>(this->numtimesteps);
 	memcpy(outinput->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmPDouble));
 	outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices);
@@ -237,15 +237,15 @@
 
 	if (this->numtimesteps > 0){
-		old_timesteps=(IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));
+		old_timesteps=xNew<IssmPDouble>(this->numtimesteps);
 		memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(IssmPDouble));
-		xfree((void**)&this->timesteps); 
+		xDelete<double>(this->timesteps); 
 	}
 
 	this->numtimesteps=this->numtimesteps+1;
-	this->timesteps=(IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));
+	this->timesteps=xNew<IssmPDouble>(this->numtimesteps);
 
 	if (this->numtimesteps > 1){
 		memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(IssmPDouble));
-		xfree((void**)&old_timesteps);
+		xDelete<double>(old_timesteps);
 	}
 
Index: /issm/trunk-jpl/src/c/objects/Kriging/Quadtree.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Kriging/Quadtree.cpp	(revision 12454)
+++ /issm/trunk-jpl/src/c/objects/Kriging/Quadtree.cpp	(revision 12455)
@@ -496,5 +496,5 @@
 
 	/*Allocate indices (maximum by default*/
-	if(this->NbObs) indices = (int*)xmalloc(this->NbObs*sizeof(int));
+	if(this->NbObs) indices = xNew<int>(this->NbObs);
 	nobs = 0;
 
Index: /issm/trunk-jpl/src/c/objects/Loads/Friction.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Loads/Friction.cpp	(revision 12454)
+++ /issm/trunk-jpl/src/c/objects/Loads/Friction.cpp	(revision 12455)
@@ -33,5 +33,5 @@
 	this->analysis_type=in_analysis_type;
 	this->inputs=inputs_in;
-	this->element_type=(char*)xmalloc((strlen(element_type_in)+1)*sizeof(char));
+	this->element_type=xNew<char>(strlen(element_type_in)+1);
 	memcpy(this->element_type,element_type_in,(strlen(element_type_in)+1)*sizeof(char));
 
@@ -41,5 +41,5 @@
 /*FUNCTION Friction::~Friction() {{{*/
 Friction::~Friction(){
-	xfree((void**)&element_type);
+	xDelete<char>(element_type);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/objects/Loads/Icefront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Loads/Icefront.cpp	(revision 12454)
+++ /issm/trunk-jpl/src/c/objects/Loads/Icefront.cpp	(revision 12455)
@@ -691,5 +691,5 @@
 
 	/*Allocate: */
-	doflist=(int*)xmalloc(numberofdofs*sizeof(int));
+	doflist=xNew<int>(numberofdofs);
 
 	/*Populate: */
