Index: /issm/trunk-jpl/src/c/modules/Solverx/Solverx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Solverx/Solverx.h	(revision 13195)
+++ /issm/trunk-jpl/src/c/modules/Solverx/Solverx.h	(revision 13196)
@@ -24,8 +24,8 @@
 
 void SolverxSeq(SeqVec** puf,SeqMat* Kff, SeqVec* pf,Parameters* parameters);
-void SolverxSeq(IssmPDouble** pX,IssmPDouble* A,IssmPDouble* B,int n);
+void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n);
 
 #ifdef _HAVE_ADOLC_
-void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n, Parameters* parameters);
+void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters);
 ADOLC_ext_fct EDF_for_solverx;
 #endif
Index: /issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp	(revision 13195)
+++ /issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp	(revision 13196)
@@ -29,5 +29,4 @@
 	int M,N,N2,s;
 	SeqVec *uf = NULL;
-	IssmDouble *x  = NULL;
 
 	Kff->GetSize(&M,&N);
@@ -36,11 +35,12 @@
 	if(N!=N2)_error_("Right hand side vector of size " << N2 << ", when matrix is of size " << M << "-" << N << " !");
 	if(M!=N)_error_("Stiffness matrix should be square!");
-
+        IssmDouble *x  = xNew<IssmDouble>(N);
 #ifdef _HAVE_ADOLC_
-	SolverxSeq(&x,Kff->matrix,pf->vector,N,parameters);
+	SolverxSeq(x,Kff->matrix,pf->vector,N,parameters);
 #else
-	SolverxSeq(&x,Kff->matrix,pf->vector,N);
+	SolverxSeq(x,Kff->matrix,pf->vector,N);
 #endif
-	uf=new SeqVec(x,N);
+	uf=new SeqVec(x,N);	
+	xDelete(x);
 
 	/*Assign output pointers:*/
@@ -56,26 +56,26 @@
 int EDF_for_solverx(int n, IssmPDouble *x, int m, IssmPDouble *y) {
     if(m*(m+1)!=n)_error_("Stiffness matrix should be square!");
-    SolverxSeq(&y,x, x+m*m, m);
+    SolverxSeq(y,x, x+m*m, m);
     return 0;
 }
 
-void SolverxSeq(IssmDouble** pX,IssmDouble* A,IssmDouble* B,int n, Parameters* parameters){//{{{
+void SolverxSeq(IssmDouble *X,IssmDouble *A,IssmDouble *B,int n, Parameters* parameters){//{{{
 	// pack inputs to conform to the EDF-prescribed interface
-        IssmDouble*  adoubleEDF_X=xNew<IssmDouble>(n*(n+1)); // packed inputs, i.e. matrix and right hand side
-        for(int i=0; i<n*n;i++)adoubleEDF_X[i]    =A[i]; // pack matrix
-        for(int i=0; i<n;  i++)adoubleEDF_X[i+n*n]=B[i]; // pack the right hand side
-        IssmPDouble* pdoubleEDF_X=xNew<IssmPDouble>(n*(n+1)); // provide space to transfer inputs during call_ext_fct
-	IssmPDouble* pdoubleEDF_Y=xNew<IssmPDouble>(n);       // provide space to transfer outputs during call_ext_fct
+        IssmDouble*  adoubleEDFin=xNew<IssmDouble>(n*(n+1)); // packed inputs, i.e. matrix and right hand side
+        for(int i=0; i<n*n;i++)adoubleEDFin[i]    =A[i]; // pack matrix
+        for(int i=0; i<n;  i++)adoubleEDFin[i+n*n]=B[i]; // pack the right hand side
+        IssmPDouble* pdoubleEDFin=xNew<IssmPDouble>(n*(n+1)); // provide space to transfer inputs during call_ext_fct
+	IssmPDouble* pdoubleEDFout=xNew<IssmPDouble>(n);       // provide space to transfer outputs during call_ext_fct
 	// call the wrapped solver through the registry entry we retrieve from parameters
 	call_ext_fct(dynamic_cast<GenericParam<Adolc_edf> * >(parameters->FindParamObject(AdolcParamEnum))->GetParameterValue().myEDF_for_solverx_p,
-	             n*(n+1), pdoubleEDF_X, adoubleEDF_X,
-	             n, pdoubleEDF_Y, B);
-	xDelete(adoubleEDF_X);
-	xDelete(pdoubleEDF_X);
-	xDelete(pdoubleEDF_Y);
+	             n*(n+1), pdoubleEDFin, adoubleEDFin,
+	             n, pdoubleEDFout,X);
+	xDelete(adoubleEDFin);
+	xDelete(pdoubleEDFin);
+	xDelete(pdoubleEDFout);
 }
 /*}}}*/
 #endif
-void SolverxSeq(IssmPDouble** pX,IssmPDouble* A,IssmPDouble* B,int n){ //{{{
+void SolverxSeq(IssmPDouble * X, IssmPDouble * A, IssmPDouble * B,int n){ //{{{
 	#ifdef _HAVE_GSL_
 	/*GSL Matrices and vectors: */
@@ -87,5 +87,5 @@
 	/*A will be modified by LU decomposition. Use copy*/
 	double* Acopy = xNew<double>(n*n);
-	xMemCpy<double>(Acopy,A,n*n);
+	xMemCpy(Acopy,A,n*n);
 
 	/*Initialize gsl matrices and vectors: */
@@ -103,12 +103,10 @@
 
 	/*Copy result*/
-	double* X = xNew<double>(n);
-	memcpy(X,gsl_vector_ptr(x,0),n*sizeof(double));
+	xMemCpy(X,gsl_vector_ptr(x,0),n);
 
 	/*Clean up and assign output pointer*/
-	xDelete<double>(Acopy);
+	xDelete(Acopy);
 	gsl_permutation_free(p);
 	gsl_vector_free(x);
-	*pX=X;
 	#endif
 }
