Index: /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 16176)
+++ /issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp	(revision 16177)
@@ -13,4 +13,5 @@
 #include "../io/Print/Print.h"
 #include "../io/Comm/IssmComm.h"
+#include "../MemOps/MemOps.h"
 
 ErrorException::ErrorException(const string & what_arg){/*{{{*/
@@ -80,17 +81,19 @@
 	/*Output*/
 	std::ostringstream buffer;
+	char *message = NULL;
 
 	/*WINDOWS*/
 	if(!function_name || file_line==0){ 
 		buffer << " error message: " << this->what_str;
-		const string buffer2 = buffer.str();
-		return buffer2.c_str();
+	}
+	else{
+		buffer << "\nError in ==> " << this->file_name << ":" << file_line << "\n";
+		buffer << this->function_name << " error message: " << this->what_str;
 	}
 
-	buffer << "\nError in ==> " << this->file_name << ":" << file_line << "\n";
-	buffer << this->function_name << " error message: " << this->what_str;
-
-	const string buffer2 = buffer.str();
-	return buffer2.c_str();
+	/*Convert std::ostringstream to std::string and then create char* */
+	std::string buffer2 = buffer.str();
+	message = xNew<char>(strlen(buffer2.c_str())+1); sprintf(message,"%s",buffer2.c_str());
+	return message;
 }/*}}}*/
 const char* ErrorException::PythonReport() const{/*{{{*/
@@ -98,16 +101,18 @@
 	/*Output*/
 	std::ostringstream buffer;
+	char *message = NULL;
 
 	/*WINDOWS*/
 	if(!function_name || file_line==0){ 
 		buffer << " error message: " << this->what_str;
-		const string buffer2 = buffer.str();
-		return buffer2.c_str();
+	}
+	else{
+		buffer << "\nError in ==> " << this->file_name << ":" << file_line << "\n";
+		buffer << this->function_name << " error message: " << this->what_str;
 	}
 
-	buffer << "\nError in ==> " << this->file_name << ":" << file_line << "\n";
-	buffer << this->function_name << " error message: " << this->what_str;
-
-	const string buffer2 = buffer.str();
-	return buffer2.c_str();
+	/*Convert std::ostringstream to std::string and then create char* */
+	std::string buffer2 = buffer.str();
+	message = xNew<char>(strlen(buffer2.c_str())+1); sprintf(message,"%s",buffer2.c_str());
+	return message;
 }/*}}}*/
