sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 8c526bbb03a5171422cf71b0217d271feeb072b6
parent 248ea93c1af7eae5a57c354b0e2e50898f57b17d
Author: Dominique Martinet <asmadeus@codewreck.org>
Date:   Sun,  1 Jul 2018 23:34:07 +0900

config include: fix leak on relative include path

Found through static analysis

Diffstat:
Msway/config.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sway/config.c b/sway/config.c @@ -425,7 +425,7 @@ static bool load_include_config(const char *path, const char *parent_dir, // save parent config const char *parent_config = config->current_config; - char *full_path = strdup(path); + char *full_path; int len = strlen(path); if (len >= 1 && path[0] != '/') { len = len + strlen(parent_dir) + 2; @@ -436,6 +436,8 @@ static bool load_include_config(const char *path, const char *parent_dir, return false; } snprintf(full_path, len, "%s/%s", parent_dir, path); + } else { + full_path = strdup(path); } char *real_path = realpath(full_path, NULL);