From 35fed183a6c49aa153fe0eee8e969c4967e817d4 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Sun, 31 Mar 2019 20:32:22 +0200 Subject: [PATCH] avoid potential leak --- src/smpi/bindings/smpi_pmpi_coll.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index 9e3f6ea3b3..5f71a3438e 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -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) -- 2.20.1