Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'mc' into mc++
[simgrid.git] / src / smpi / colls / reduce-binomial.c
index a7ece3e..597c2e4 100644 (file)
@@ -1,3 +1,9 @@
+/* Copyright (c) 2013-2014. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #include "colls_private.h"
 
 //#include <star-reduction.c>
@@ -70,14 +76,17 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
     mask <<= 1;
   }
 
-if (!is_commutative && (root != 0)){
-  if (rank == 0){
-    smpi_mpi_send(recvbuf, count, datatype, root,tag, comm);
-  }else if (rank == root){
-    smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status);
+  if (!is_commutative && (root != 0)){
+    if (rank == 0){
+      smpi_mpi_send(recvbuf, count, datatype, root,tag, comm);
+    }else if (rank == root){
+      smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status);
+    }
   }
-}
 
+  if (rank != root) {
+        xbt_free(recvbuf);
+  }
   free(tmp_buf);
 
   return 0;