From 418bfdefc990711913564d0bb4c58a1dd9d78c30 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 12 Mar 2014 09:33:52 +0100 Subject: [PATCH] Free allocated string. --- examples/msg/io/storage.c | 3 ++- teshsuite/msg/storage/storage_basic.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/msg/io/storage.c b/examples/msg/io/storage.c index eb6abcc786..9f2a266758 100644 --- a/examples/msg/io/storage.c +++ b/examples/msg/io/storage.c @@ -101,9 +101,10 @@ static int host(int argc, char *argv[]){ XBT_INFO("Get data: '%s'", data); - MSG_storage_set_data(storage,strdup("Some user data")); + MSG_storage_set_data(storage, xbt_strdup("Some user data")); data = MSG_storage_get_data(storage); XBT_INFO("Set and get data: '%s'", data); + xbt_free(data); xbt_free(storage_name); diff --git a/teshsuite/msg/storage/storage_basic.c b/teshsuite/msg/storage/storage_basic.c index e4f88310b6..fa5f5ead5d 100644 --- a/teshsuite/msg/storage/storage_basic.c +++ b/teshsuite/msg/storage/storage_basic.c @@ -132,9 +132,10 @@ void get_set_storage_data(const char *storage_name){ char *data = MSG_storage_get_data(storage); XBT_INFO("Get data: '%s'", data); - MSG_storage_set_data(storage,strdup("Some data")); + MSG_storage_set_data(storage, xbt_strdup("Some data")); data = MSG_storage_get_data(storage); XBT_INFO("\tSet and get data: '%s'", data); + xbt_free(data); } int client(int argc, char *argv[]) -- 2.20.1