Index: /issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 16498)
+++ /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 16499)
@@ -1088,12 +1088,12 @@
 
 	/*output: */
-	int   numstrings=0;
-	char** strings=NULL;
+	int    numstrings = 0;
+	char **strings    = NULL;
 
 	/*intermediary: */
-	char* string=NULL;
-	int   string_size;
-	int*   code=NULL;
-	fpos_t* file_positions=NULL;
+	char   *string         = NULL;
+	int     string_size;
+	int    *code           = NULL;
+	fpos_t *file_positions = NULL;
 
 	/*recover my_rank:*/
@@ -1104,9 +1104,7 @@
 
 	if(num_instances){
-
 		strings=xNew<char*>(num_instances);
 
 		for(i=0;i<num_instances;i++){
-
 
 			if(my_rank==0){
@@ -1138,5 +1136,4 @@
 			strings[i]=string;
 		}
-
 	}
 	/*Free ressources:*/
@@ -1153,22 +1150,20 @@
 	int i;
 	int num_instances;
-	int my_rank;
-	
 	fpos_t* file_positions=NULL;
 
 	/*output: */
-	IssmDouble** matrices=NULL;
-	int*     mdims=NULL;
-	int*     ndims=NULL;
+	IssmDouble **matrices = NULL;
+	int         *mdims    = NULL;
+	int         *ndims    = NULL;
 
 	/*intermediary: */
-	int     M, N;
+	int          M, N;
 	IssmPDouble *pmatrix = NULL;
-	IssmDouble *matrix = NULL;
-	int*    codes=NULL;
-	int     code;
+	IssmDouble  *matrix  = NULL;
+	int         *codes   = NULL;
+	int          code;
 
 	/*recover my_rank:*/
-	my_rank=IssmComm::GetRank();
+	int my_rank=IssmComm::GetRank();
 	
 	/*Get file pointers to beginning of the data (multiple instances of it): */
@@ -1182,5 +1177,5 @@
 		ndims=xNew<int>(num_instances);
 
-		for(i=0;i<num_instances;i++){
+		for(int i=0;i<num_instances;i++){
 
 			if(my_rank==0){
@@ -1213,5 +1208,5 @@
 
 				_assert_(this->independents);
-				if (this->independents[data_enum]){
+				if(this->independents[data_enum]){
 					/*this data has already been checked out! So cancel all that we've done here, and return 
 					 * the data[data_enum] directly: */
@@ -1240,6 +1235,16 @@
 	/*Assign output pointers: */
 	*pmatrices=matrices;
-	if(pmdims)*pmdims=mdims;
-	if(pndims)*pndims=ndims;
+	if(pmdims){
+		*pmdims=mdims;
+	}
+	else{
+		xDelete<int>(mdims);
+	}
+	if(pndims){
+		*pndims=ndims;
+	}
+	else{
+		xDelete<int>(ndims);
+	}
 	*pnumrecords=num_instances;
 }
@@ -1448,18 +1453,17 @@
 fpos_t* IoModel::SetFilePointersToData(int** pcodes,int** pvector_types, int* pnum_instances, int data_enum){
 
-	int  my_rank;
-	int  found         = 0;
-	int  record_enum;
-	int  record_length;
-	int  record_code;       //1 to 7 number
-	int  vector_type;       //1 to 7 number
-	int* vector_types   = NULL;
-	int* codes= NULL;
-	int  num_instances  = 0;
-	int  counter;
-	fpos_t* file_positions=NULL;
+	int     found          = 0;
+	int     record_enum;
+	int     record_length;
+	int     record_code;           //1 to 7 number
+	int     vector_type;           //1 to 7 number
+	int    *vector_types   = NULL;
+	int    *codes          = NULL;
+	int     num_instances  = 0;
+	int     counter;
+	fpos_t *file_positions = NULL;
 
 	/*recover my_rank:*/
-	my_rank=IssmComm::GetRank();
+	int my_rank=IssmComm::GetRank();
 
 	/*Go find in the binary file, the data we want to fetch and count the number of 
@@ -1489,8 +1493,7 @@
 		if(num_instances){
 			file_positions = xNew<fpos_t>(num_instances);
-			codes = xNew<int>(num_instances);
-			vector_types = xNew<int>(num_instances);
-		}
-
+			codes          = xNew<int>(num_instances);
+			vector_types   = xNew<int>(num_instances);
+		}
 	
 		/*Reset FILE* position to the beginning of the file, and start again, this time saving the data information 
@@ -1516,6 +1519,6 @@
 					if(fread(&vector_type,sizeof(int),1,fid)!=1) _error_("Could not read vector_type");
 				}
-				codes[counter]=record_code;
-				vector_types[counter]=vector_type;
+				codes[counter]        = record_code;
+				vector_types[counter] = vector_type;
 				fgetpos(fid,file_positions+counter);
 				
@@ -1540,7 +1543,12 @@
 
 	/*Assign output pointers:*/
-	*pcodes=codes;
-	*pnum_instances=num_instances;
-	if(pvector_types)*pvector_types=vector_types;
+	*pcodes         = codes;
+	*pnum_instances = num_instances;
+	if(pvector_types){
+		*pvector_types=vector_types;
+	}
+	else{
+		xDelete<int>(vector_types);
+	}
 	return file_positions;
 }
Index: /issm/trunk-jpl/src/c/classes/Massfluxatgate.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 16498)
+++ /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 16499)
@@ -127,8 +127,7 @@
 		/*Definition virtual function resolutoin: */
 		/*FUNCTION char* Name() {{{*/
-		char*  Name(){
-			char* name2=NULL;
+		char* Name(){
 
-			name2=xNew<char>(strlen(this->name)+1);
+			char* name2=xNew<char>(strlen(this->name)+1);
 			xMemCpy(name2,this->name,strlen(this->name)+1);
 
Index: /issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp	(revision 16498)
+++ /issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp	(revision 16499)
@@ -22,10 +22,13 @@
 		definition=dynamic_cast<Definition*>(output_definitions->GetObjectByOffset(i));
 
-		if (strcmp(definition->Name(),output_string)==0){
+		char* name = definition->Name();
+		if (strcmp(name,output_string)==0){
 			/*This is the object that we have been chasing for. compute the response and return: */
 			return_value=definition->Response(femmodel);
 			delete output_definitions;
+			xDelete<char>(name);
 			return return_value;
 		}
+		xDelete<char>(name);
 	}
 	/*If we are here, did not find the definition for this response, not good!: */
