mirror of
https://github.com/irssi/irssi.git
synced 2025-04-26 04:51:11 -05:00
Fix a memory leak.
g_get_current_dir() returns a heap-allocated string.
This commit is contained in:
parent
acbe2ecac2
commit
b545bc96a9
@ -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…
x
Reference in New Issue
Block a user