From b729f6f9f053b2314204b48e7d350738ae548c5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 18 Jul 2019 16:11:59 -0400 Subject: [PATCH] relayd: remove unnecessary allocation in session path formatting MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit `alloc_path` merely contains the contents of `default_path`. The allocation of `alloc_path` can be removed and `default_path` used in its place. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-relayd/utils.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/bin/lttng-relayd/utils.c b/src/bin/lttng-relayd/utils.c index 837c828d2..7ae0879e5 100644 --- a/src/bin/lttng-relayd/utils.c +++ b/src/bin/lttng-relayd/utils.c @@ -33,7 +33,6 @@ static char *create_output_path_auto(const char *path_name) { int ret; char *traces_path = NULL; - char *alloc_path = NULL; char *default_path; default_path = utils_get_home_dir(); @@ -42,19 +41,13 @@ static char *create_output_path_auto(const char *path_name) Please specify an output path using -o, --output PATH"); goto exit; } - alloc_path = strdup(default_path); - if (alloc_path == NULL) { - PERROR("Path allocation"); - goto exit; - } ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME - "/%s", alloc_path, path_name); + "/%s", default_path, path_name); if (ret < 0) { PERROR("asprintf trace dir name"); goto exit; } exit: - free(alloc_path); return traces_path; } -- 2.34.1