Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug two memleak in smpi, and cosmetics
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 15 Aug 2016 11:45:50 +0000 (13:45 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 15 Aug 2016 12:09:45 +0000 (14:09 +0200)
src/smpi/smpi_comm.cpp
src/smpi/smpi_f77.cpp
src/smpi/smpi_mpi_dt.cpp

index 22aab8e..99625ce 100644 (file)
@@ -111,6 +111,7 @@ int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm){
           if(ret!=MPI_SUCCESS){
             smpi_comm_destroy(*newcomm);
             *newcomm=MPI_COMM_NULL;
+            xbt_dict_cursor_free(&cursor);
             return ret;
           }
           if(flag)
index 7668381..0ab3b36 100644 (file)
@@ -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);
index 43af712..5f66b31 100644 (file)
@@ -25,12 +25,12 @@ int type_keyval_id=0;//avoid collisions
   static s_smpi_mpi_datatype_t mpi_##name = {         \
     (char*) # name,                                   \
     sizeof(type),   /* size */                        \
-    0,              /*was 1 sizeof_substruct*/             \
+    0,              /*was 1 sizeof_substruct*/        \
     0,              /* lb */                          \
     sizeof(type),   /* ub = lb + size */              \
     DT_FLAG_BASIC,  /* flags */                       \
-    nullptr,           /* attributes */                  \
-    nullptr,           /* pointer on extended struct*/   \
+    nullptr,        /* attributes */                  \
+    nullptr,        /* pointer on extended struct*/   \
     0               /* in_use counter */              \
   };                                                  \
 const MPI_Datatype name = &mpi_##name;
@@ -39,12 +39,12 @@ const MPI_Datatype name = &mpi_##name;
   static s_smpi_mpi_datatype_t mpi_##name = {         \
     (char*) # name,                                   \
     0,              /* size */                        \
-    0,              /* was 1 sizeof_substruct*/            \
+    0,              /* was 1 sizeof_substruct*/       \
     0,              /* lb */                          \
     0,              /* ub = lb + size */              \
     DT_FLAG_BASIC,  /* flags */                       \
-    nullptr,           /* attributes */                  \
-    nullptr,           /* pointer on extended struct*/   \
+    nullptr,        /* attributes */                  \
+    nullptr,        /* pointer on extended struct*/   \
     0               /* in_use counter */              \
   };                                                  \
 const MPI_Datatype name = &mpi_##name;
@@ -930,8 +930,7 @@ s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create( int* block_lengths, MPI_Ai
   new_t->base.subtype_use = &use_hindexed;
   new_t->block_lengths= xbt_new(int, block_count);
   new_t->block_indices= xbt_new(MPI_Aint, block_count);
-  int i;
-  for(i=0;i<block_count;i++){
+  for(int i=0;i<block_count;i++){
     new_t->block_lengths[i]=block_lengths[i];
     new_t->block_indices[i]=block_indices[i];
   }