From dcb9ba7d72e38cec362d4b04179eeb5e89635aca Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Thu, 18 Apr 2019 21:47:41 +0200 Subject: [PATCH] be cleaner with memory --- src/smpi/include/smpi_file.hpp | 2 +- teshsuite/smpi/io-all/io-all.c | 2 +- teshsuite/smpi/io-ordered/io-ordered.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/smpi/include/smpi_file.hpp b/src/smpi/include/smpi_file.hpp index 72efd93580..fa3b505125 100644 --- a/src/smpi/include/smpi_file.hpp +++ b/src/smpi/include/smpi_file.hpp @@ -151,7 +151,7 @@ class File{ } XBT_DEBUG("will have to access %lld from my chunk", totreads); - char* sendbuf= static_cast(smpi_get_tmp_sendbuffer(totreads)); + char* sendbuf= static_cast(smpi_get_tmp_sendbuffer(total_sent)); if(totreads>0){ seek(min_offset, MPI_SEEK_SET); diff --git a/teshsuite/smpi/io-all/io-all.c b/teshsuite/smpi/io-all/io-all.c index 56d95b3b27..0f97937747 100644 --- a/teshsuite/smpi/io-all/io-all.c +++ b/teshsuite/smpi/io-all/io-all.c @@ -20,7 +20,7 @@ int main( int argc, char *argv[] ) MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); MPI_Comm_size( comm, &size ); MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( 10+ size * sizeof(int) ); + buf = (int *)malloc( 10 * sizeof(int) ); buf[0] = rank; /* Write to file */ diff --git a/teshsuite/smpi/io-ordered/io-ordered.c b/teshsuite/smpi/io-ordered/io-ordered.c index e5225dfbbd..7fae204439 100644 --- a/teshsuite/smpi/io-ordered/io-ordered.c +++ b/teshsuite/smpi/io-ordered/io-ordered.c @@ -20,7 +20,7 @@ int main( int argc, char *argv[] ) MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); MPI_Comm_size( comm, &size ); MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( 10+size * sizeof(int) ); + buf = (int *)malloc( 10* sizeof(int) ); buf[0] = rank; /* Write to file */ -- 2.20.1