Index: /issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp	(revision 13172)
+++ /issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp	(revision 13173)
@@ -11,4 +11,5 @@
 	char*   name=NULL;
 	char*   notes=NULL;
+	char*   notes2=NULL;
 	const mxArray* notesi;
 	mwIndex        nindex;
@@ -60,5 +61,10 @@
 				else {
 /*  note that strlen does not include trailing null  */
-					notes=(char*)xrealloc(notes,(strlen(notes)+1+mxGetNumberOfElements(notesi)+1)*sizeof(char));
+					notes2=xNew<char>(strlen(notes)+1+mxGetNumberOfElements(notesi)+1);
+					memcpy(notes2,notes,(strlen(notes)+1)*sizeof(char));
+					xDelete<char>(notes);
+					notes=notes2;
+					notes2=NULL;
+//					notes=(char*)xrealloc(notes,(strlen(notes)+1+mxGetNumberOfElements(notesi)+1)*sizeof(char));
 					strcat(notes,"\n");
 					mxGetString(notesi,&notes[strlen(notes)],mxGetNumberOfElements(notesi)+1);
