mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 09:02:13 +02:00
Fix a memory leak.
g_get_current_dir() returns a heap-allocated string.
This commit is contained in:
parent
acbe2ecac2
commit
b545bc96a9
1 changed files with 7 additions and 1 deletions
|
|
@ -156,11 +156,17 @@ static void sig_init_finished(void)
|
||||||
static char *fix_path(const char *str)
|
static char *fix_path(const char *str)
|
||||||
{
|
{
|
||||||
char *new_str = convert_home(str);
|
char *new_str = convert_home(str);
|
||||||
|
|
||||||
if (!g_path_is_absolute(new_str)) {
|
if (!g_path_is_absolute(new_str)) {
|
||||||
char *tmp_str = 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);
|
g_free(tmp_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_str;
|
return new_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue