Fix: Use after free on spawn_sessiond error path in check_sessiond
[lttng-tools.git] / src / bin / lttng / conf.c
index 995407d03d4d4ba6863ee991c6da927df06e8db8..7439c1cdcf4d0fac711f7a5f4acfbd018a83a773 100644 (file)
@@ -65,9 +65,7 @@ static FILE *open_config(char *path, const char *mode)
        }
 
 error:
-       if (file_path) {
-               free(file_path);
-       }
+       free(file_path);
        return fp;
 }
 
@@ -205,6 +203,7 @@ char *config_read_session_name(char *path)
        if (fp == NULL) {
                ERR("Can't find valid lttng config %s/.lttngrc", path);
                MSG("Did you create a session? (lttng create <my_session>)");
+               free(session_name);
                goto error;
        }
 
@@ -223,6 +222,7 @@ char *config_read_session_name(char *path)
        }
 
 error_close:
+       free(session_name);
        ret = fclose(fp);
        if (ret < 0) {
                PERROR("close config read session name");
This page took 0.026532 seconds and 5 git commands to generate.