From: Arnaud Giersch Date: Tue, 5 Feb 2019 09:47:52 +0000 (+0100) Subject: Reset pointer to make it clear for cppcheck that it's not freed twice. X-Git-Tag: v3_22~390^2~11 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b396b4094f7ccf68fcdd4068bce9752c70203eac Reset pointer to make it clear for cppcheck that it's not freed twice. --- diff --git a/examples/smpi/ampi_test/ampi_test.cpp b/examples/smpi/ampi_test/ampi_test.cpp index 9dfdd18c81..9c7650a961 100644 --- a/examples/smpi/ampi_test/ampi_test.cpp +++ b/examples/smpi/ampi_test/ampi_test.cpp @@ -29,11 +29,13 @@ int main(int argc, char* argv[]) AMPI_Iteration_in(MPI_COMM_WORLD); simgrid::s4u::this_actor::sleep_for(rank); AMPI_Iteration_out(MPI_COMM_WORLD); - if (rank == 0) + if (rank == 0) { free(pointer); + pointer = nullptr; + } AMPI_Migrate(MPI_COMM_WORLD); if (rank != 0) - free(pointer); + free(pointer); MPI_Finalize(); return 0;