Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix a memory leak happening with smpi_replay
[simgrid.git] / src / smpi / smpi_base.c
index 4d58f24..5192ca3 100644 (file)
@@ -5,7 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "private.h"
-#include "xbt/time.h"
+#include "xbt/virtu.h"
 #include "mc/mc.h"
 #include "xbt/replay.h"
 #include <errno.h>
@@ -178,9 +178,10 @@ void smpi_mpi_start(MPI_Request request)
       if(request->old_type->has_subtype == 0){
         oldbuf = request->buf;
         request->detached = 1;
-        request->buf = malloc(request->size);
-        if (oldbuf)
+        if (oldbuf){
+          request->buf = malloc(request->size);
           memcpy(request->buf,oldbuf,request->size);
+        }
       }
       XBT_DEBUG("Send request %p is detached; buf %p copied into %p",request,oldbuf,request->buf);
     }