Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug two memleak in smpi, and cosmetics
[simgrid.git] / src / smpi / smpi_f77.cpp
index 248334e..0ab3b36 100644 (file)
@@ -600,9 +600,8 @@ void mpi_test_ (int * request, int *flag, MPI_Status * status, int* ierr){
 }
 
 void mpi_testall_ (int* count, int * requests,  int *flag, MPI_Status * statuses, int* ierr){
-  MPI_Request* reqs;
   int i;
-  reqs = xbt_new(MPI_Request, *count);
+  MPI_Request* reqs = xbt_new(MPI_Request, *count);
   for(i = 0; i < *count; i++) {
     reqs[i] = smpi_request_f2c(requests[i]);
   }
@@ -613,6 +612,7 @@ void mpi_testall_ (int* count, int * requests,  int *flag, MPI_Status * statuses
         requests[i]=MPI_FORTRAN_REQUEST_NULL;
     }
   }
+  xbt_free(reqs);
 }
 
 void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){
@@ -778,8 +778,8 @@ void mpi_info_set_( int *info, char *key, char *value, int* ierr, unsigned int k
   }
   char* tvalue = xbt_new(char,valuelen+1);
   strncpy(tvalue, value, valuelen);
-
   tvalue[valuelen]='\0'; 
+
   *ierr =  MPI_Info_set( smpi_info_f2c(*info), tkey, tvalue);
   xbt_free(tkey);
 }
@@ -810,6 +810,12 @@ void mpi_info_get_ (int* info,char *key,int* valuelen, char *value, int *flag, i
 
 void mpi_info_free_(int* info, int* ierr){
   MPI_Info tmp = smpi_info_f2c(*info);
+  const char* key;
+  char* val;
+  xbt_dict_cursor_t cursor;
+  xbt_dict_foreach(tmp->info_dict,cursor,key,val) {
+    xbt_free(val);
+  }
   *ierr =  MPI_Info_free(&tmp);
   if(*ierr == MPI_SUCCESS) {
     free_info(*info);