Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix potential mem leak seen by scan-build.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 26 May 2021 07:30:23 +0000 (09:30 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 26 May 2021 07:30:23 +0000 (09:30 +0200)
Note that ret should not normally be different than MPI_SUCCESS in the other case.

src/smpi/mpi/smpi_comm.cpp

index 3962016..6c350f0 100644 (file)
@@ -98,9 +98,9 @@ int Comm::dup(MPI_Comm* newcomm){
           flag = 1;
         } else { // not null, nor dup
           elem.copy_fn.comm_copy_fn_fort(this, it.first, elem.extra_state, it.second, value_out, &flag, &ret);
-          if (ret != MPI_SUCCESS)
-            xbt_free(value_out);
         }
+        if (ret != MPI_SUCCESS)
+          xbt_free(value_out);
       }
       if (ret != MPI_SUCCESS) {
         Comm::destroy(*newcomm);