relayd: remove unnecessary allocation in session path formatting
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Jul 2019 20:11:59 +0000 (16:11 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 9 Aug 2019 15:28:43 +0000 (11:28 -0400)
`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 <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/utils.c

index 837c828d22b935cb7eb353a60f6d3e93f2dc277d..7ae0879e598674007cdee164cee4d2ff2c263c70 100644 (file)
@@ -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;
 }
 
This page took 0.025722 seconds and 4 git commands to generate.