From 4f1b870c89a0d6481e0f0b8252db600e80dfe2ca Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 28 Nov 2011 23:27:20 +0100 Subject: [PATCH 1/1] Fix uninitialized variable. --- src/instr/jedule/jedule_platform.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/instr/jedule/jedule_platform.c b/src/instr/jedule/jedule_platform.c index ebcfa4bb4f..d6b488bb97 100644 --- a/src/instr/jedule/jedule_platform.c +++ b/src/instr/jedule/jedule_platform.c @@ -86,8 +86,7 @@ void jed_simgrid_add_resources(jed_simgrid_container_t parent, unsigned int iter; char *host_name; - char buf[16]; - char *buf_copy; + char *buf; parent->is_lowest = 1; xbt_dynar_free(&parent->container_children); @@ -99,10 +98,9 @@ void jed_simgrid_add_resources(jed_simgrid_container_t parent, xbt_dynar_sort (host_names, &compare_hostnames); xbt_dynar_foreach(host_names, iter, host_name) { - buf_copy = strdup(buf); - sprintf(buf_copy, "%d", parent->last_id); + buf = bprintf("%d", parent->last_id); (parent->last_id)++; - xbt_dict_set(parent->name2id, host_name, buf_copy, NULL); + xbt_dict_set(parent->name2id, host_name, buf, xbt_free); xbt_dict_set(host2_simgrid_parent_container, host_name, parent, NULL); xbt_dynar_push(parent->resource_list, &host_name); } -- 2.20.1