diff options
author | LemonBoy <thatlemon@gmail.com> | 2015-10-02 12:39:08 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2015-10-02 12:39:08 +0200 |
commit | b545bc96a9e1a875beb50d9202161864ca8164d8 (patch) | |
tree | 63ca7ce8f75b4b71b30a552c3b9a95ce5b4c93d3 /src/core | |
parent | acbe2ecac299d4f6770c60747776cbea290bee3f (diff) | |
download | irssi-b545bc96a9e1a875beb50d9202161864ca8164d8.zip |
Fix a memory leak.
g_get_current_dir() returns a heap-allocated string.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/core.c b/src/core/core.c index b9debbb5..879d346f 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -156,11 +156,17 @@ static void sig_init_finished(void) static char *fix_path(const char *str) { char *new_str = convert_home(str); + if (!g_path_is_absolute(new_str)) { char *tmp_str = new_str; - new_str = g_strdup_printf("%s/%s", g_get_current_dir(), tmp_str); + char *current_dir = g_get_current_dir(); + + new_str = g_build_path(G_DIR_SEPARATOR_S, current_dir, tmp_str); + + g_free(current_dir); g_free(tmp_str); } + return new_str; } |