me
/
guix
Archived
1
0
Fork 0
This repository has been archived on 2024-08-07. You can view files and clone it, but cannot push or open issues/pull-requests.
guix/gnu/packages/patches/libpaper-free-xdg-config-ho...

38 lines
1.3 KiB
Diff

Free the xdg_config_home_variable only when needed.
Taken from upstream:
https://github.com/rrthomas/libpaper/commit/29e3e3800cfea738f12a9760290b92d5c199092b
diff --git a/lib/libpaper.c.in.in b/lib/libpaper.c.in.in
index f7af1d7..aa86d06 100644
--- a/lib/libpaper.c.in.in
+++ b/lib/libpaper.c.in.in
@@ -295,7 +295,6 @@ const char *defaultpapername(void) {
const char *paperstr = getenv("PAPERSIZE");
if (paperstr == NULL && xdg_config_home != NULL) {
- free_xdg_config_home = true;
char *papersize = mfile_name_concat(xdg_config_home, PAPERSIZE_FILENAME, NULL);
if (papersize != NULL) {
paperstr = papernamefile(papersize);
@@ -374,6 +373,7 @@ int paperinit(void)
xdg_config_home = getenv("XDG_CONFIG_HOME");
if (xdg_config_home == NULL) {
char *home = getenv("HOME");
+ free_xdg_config_home = true;
xdg_config_home = mfile_name_concat(home, ".config", NULL);
if (xdg_config_home == NULL)
return PAPER_NOMEM;
@@ -409,8 +409,10 @@ int paperdone(void)
{
if (initialized) {
free(sysconfdir);
+ sysconfdir = NULL;
if (free_xdg_config_home)
free(xdg_config_home);
+ xdg_config_home = NULL;
initialized = false;
}
return PAPER_OK;