Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
avoid potential leak
authorAugustin Degomme <adegomme@users.noreply.github.com>
Sun, 31 Mar 2019 18:32:22 +0000 (20:32 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Sun, 31 Mar 2019 18:33:42 +0000 (20:33 +0200)
src/smpi/bindings/smpi_pmpi_coll.cpp

index 9e3f6ea..5f71a34 100644 (file)
@@ -811,8 +811,11 @@ int PMPI_Ialltoallw(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
     MPI_Datatype* sendtmptypes = sendtypes;
     unsigned long maxsize                = 0;
     for (int i = 0; i < size; i++) { // copy data to avoid bad free
-      if(recvtypes[i]==MPI_DATATYPE_NULL)
+      if(recvtypes[i]==MPI_DATATYPE_NULL){
+        delete trace_recvcounts;
+        delete trace_sendcounts;
         return MPI_ERR_TYPE;
+      }
       recv_size += recvcounts[i] * recvtypes[i]->size();
       trace_recvcounts->push_back(recvcounts[i] * recvtypes[i]->size());
       if ((recvdisps[i] + (recvcounts[i] * recvtypes[i]->size())) > maxsize)