Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix use-after-free.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 6 Sep 2017 13:14:31 +0000 (15:14 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 9 Sep 2017 19:55:05 +0000 (21:55 +0200)
'message' is not mine if I didn't get an answer.

examples/s4u/dht-chord/node.cpp

index b39c9f7..d97b6b1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2017. 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. */
 
 /* 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. */
@@ -236,13 +236,13 @@ void Node::checkPredecessor()
   try {
     comm->wait(timeout);
     XBT_DEBUG("Received the answer to my 'Predecessor Alive': my predecessor %d is alive", pred_id_);
   try {
     comm->wait(timeout);
     XBT_DEBUG("Received the answer to my 'Predecessor Alive': my predecessor %d is alive", pred_id_);
+    delete static_cast<ChordMessage*>(data);
   } catch (xbt_ex& e) {
     if (e.category == timeout_error) {
       XBT_DEBUG("Failed to receive the answer to my 'Predecessor Alive' request");
       pred_id_ = -1;
     }
   }
   } catch (xbt_ex& e) {
     if (e.category == timeout_error) {
       XBT_DEBUG("Failed to receive the answer to my 'Predecessor Alive' request");
       pred_id_ = -1;
     }
   }
-  delete message;
 }
 
 /* Asks its predecessor to a remote node
 }
 
 /* Asks its predecessor to a remote node