From 613c303dd60c8c071e7107701834d33877a4d285 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 19 Apr 2016 20:49:20 +0200 Subject: [PATCH 1/1] plug some easy memleak --- examples/msg/app-bittorrent/bittorrent.c | 3 +-- examples/msg/cloud-simple/cloud-simple.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/msg/app-bittorrent/bittorrent.c b/examples/msg/app-bittorrent/bittorrent.c index 4fc3fb19e1..b469d4ea82 100644 --- a/examples/msg/app-bittorrent/bittorrent.c +++ b/examples/msg/app-bittorrent/bittorrent.c @@ -13,7 +13,6 @@ /** Bittorrent example launcher */ int main(int argc, char *argv[]) { - xbt_dynar_t host_list; msg_host_t host; unsigned i; @@ -27,7 +26,7 @@ int main(int argc, char *argv[]) MSG_create_environment(platform_file); - host_list = MSG_hosts_as_dynar(); + xbt_dynar_t host_list = MSG_hosts_as_dynar(); xbt_dynar_foreach(host_list, i, host) { char descr[512]; RngStream stream; diff --git a/examples/msg/cloud-simple/cloud-simple.c b/examples/msg/cloud-simple/cloud-simple.c index 4140f38498..d62c24c9b4 100644 --- a/examples/msg/cloud-simple/cloud-simple.c +++ b/examples/msg/cloud-simple/cloud-simple.c @@ -113,6 +113,7 @@ static int master_main(int argc, char *argv[]) msg_host_t pm0 = xbt_dynar_get_as(hosts_dynar, 0, msg_host_t); msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 1, msg_host_t); msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t); + xbt_dynar_free(&hosts_dynar); msg_vm_t vm0, vm1; @@ -280,6 +281,7 @@ int main(int argc, char *argv[]) xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar(); msg_host_t pm0 = xbt_dynar_get_as(hosts_dynar, 0, msg_host_t); + xbt_dynar_free(&hosts_dynar); launch_master(pm0); int res = MSG_main(); -- 2.20.1