Index: /issm/trunk-jpl/src/c/python/io/FetchPythonData.cpp
===================================================================
--- /issm/trunk-jpl/src/c/python/io/FetchPythonData.cpp	(revision 13371)
+++ /issm/trunk-jpl/src/c/python/io/FetchPythonData.cpp	(revision 13372)
@@ -63,7 +63,8 @@
 
 	/*output: */
+	double* dmatrix=NULL;
 	double* matrix=NULL;
 	int M,N;
-	int ndim;
+	int i,ndim;
 	npy_intp*  dims=NULL;
 
@@ -75,5 +76,9 @@
 	
 	/*retrieve internal value: */
-	matrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix);
+	dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix);
+
+	/*copy matrix: */
+	matrix=xNew<double>(M*N);
+	for(i=0;i<M*N;i++)matrix[i]=dmatrix[i];
 
 	/*output: */
@@ -119,7 +124,8 @@
 
 	/*output: */
+	double* dvector=NULL;
 	double* vector=NULL;
 	int M;
-	int ndim;
+	int i,ndim;
 	npy_intp*  dims=NULL;
 
@@ -131,5 +137,9 @@
 	
 	/*retrieve internal value: */
-	vector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
+	dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
+
+	/*copy vector: */
+	vector=xNew<double>(M);
+	for(i=0;i<M;i++)vector[i]=dvector[i];
 
 	/*output: */
@@ -282,4 +292,5 @@
 
 	/*clean-up and assign output pointer*/
+	xDelete<char>(contourname);
 	*pcontours=contours;
 }
@@ -294,5 +305,4 @@
 	char* string=NULL;
 
-	
 	/*convert to bytes format: */
 	PyUnicode_FSConverter(py_unicode,&py_bytes);
@@ -312,6 +322,8 @@
 	/*extract internal string: */
 	string=PyString_AsString(py_string);
-	
-	*pstring=string;
+
+	/*copy string (note strlen does not include trailing NULL): */
+	*pstring=xNew<char>(strlen(string)+1);
+	memcpy(*pstring,string,(strlen(string)+1)*sizeof(char));
 }
 /*}}}*/
