From b21ff70375d8bb1c8e7743cba50afe0fe6f3b909 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 6 Sep 2017 15:14:31 +0200 Subject: [PATCH 1/1] Fix use-after-free. 'message' is not mine if I didn't get an answer. --- examples/s4u/dht-chord/node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/s4u/dht-chord/node.cpp b/examples/s4u/dht-chord/node.cpp index b39c9f749d..d97b6b1c33 100644 --- a/examples/s4u/dht-chord/node.cpp +++ b/examples/s4u/dht-chord/node.cpp @@ -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. */ @@ -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_); + delete static_cast(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; } } - delete message; } /* Asks its predecessor to a remote node -- 2.20.1