Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix memory leaks in smpi.
[simgrid.git] / src / smpi / smpi_mpi_dt.c
index d42e29f..06123eb 100644 (file)
@@ -181,7 +181,7 @@ int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
       s_smpi_mpi_vector_t* type_c = (s_smpi_mpi_vector_t*)sendtype;
 
-      void * buf_tmp = malloc(count * type_c->size_oldtype);
+      void * buf_tmp = xbt_malloc(count * type_c->size_oldtype);
 
       subtype->serialize( sendbuf, buf_tmp,1, subtype);
       subtype =  recvtype->substruct;
@@ -311,6 +311,7 @@ void smpi_datatype_free(MPI_Datatype* type){
 
   if ((*type)->has_subtype == 1){
     ((s_smpi_subtype_t *)(*type)->substruct)->subtype_free(type);  
+    xbt_free((*type)->substruct);
   }
   xbt_free(*type);