From 0ffa65348da9e6ed158391cf57116c8e701f098a Mon Sep 17 00:00:00 2001 From: altf_four Date: Mon, 25 Jan 2021 06:32:10 +0000 Subject: [PATCH] xdg-support: fix memory leak using g_strdup_printf --- src/fe-common/core/themes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index 6a465918..cfd17968 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -920,7 +920,7 @@ THEME_REC *theme_load(const char *setname) { THEME_REC *theme, *oldtheme; struct stat statbuf; - char *fname, *name, *p; + char *fname, *fbname, *name, *p; name = g_strdup(setname); p = strrchr(name, '.'); @@ -932,7 +932,9 @@ THEME_REC *theme_load(const char *setname) theme = theme_find(name); /* check home dir */ - fname = g_build_filename(get_irssi_dir(), g_strdup_printf("%s.theme", name), NULL); + fbname = g_strdup_printf("%s.theme", name); /* file base name */ + fname = g_build_filename(get_irssi_dir(), fbname, NULL); + g_free(fbname); if (stat(fname, &statbuf) != 0) { /* check global config dir */ g_free(fname);