Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix potential memory leaks.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 31 May 2020 13:37:29 +0000 (15:37 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 31 May 2020 13:42:48 +0000 (15:42 +0200)
examples/c/dht-pastry/dht-pastry.c

index b0784ec..c6e5947 100644 (file)
@@ -236,6 +236,7 @@ static void handle_message(node_t node, pastry_message_t message)
         err  = sg_comm_wait_for(comm, timeout);
         if (err == SG_ERROR_TIMEOUT) {
           XBT_DEBUG("Timeout expired when forwarding join to next %d", next);
+          xbt_free(request);
           break;
         }
         type = JOIN_REPLY;
@@ -250,6 +251,7 @@ static void handle_message(node_t node, pastry_message_t message)
       err                = sg_comm_wait_for(comm, timeout);
       if (err == SG_ERROR_TIMEOUT) {
         XBT_DEBUG("Timeout expired when sending back the current node state to the joining node to %d", node->id);
+        message_free(request);
       }
       break;
     /* Join reply from all the node touched by the join  */
@@ -311,6 +313,7 @@ static void handle_message(node_t node, pastry_message_t message)
             err                = sg_comm_wait_for(comm, timeout);
             if (err == SG_ERROR_TIMEOUT) {
               XBT_DEBUG("Timeout expired when sending update to %d", j);
+              message_free(request);
               break;
             }
           }