summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libpaper-free-xdg-config-home.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/libpaper-free-xdg-config-home.patch')
-rw-r--r--gnu/packages/patches/libpaper-free-xdg-config-home.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/gnu/packages/patches/libpaper-free-xdg-config-home.patch b/gnu/packages/patches/libpaper-free-xdg-config-home.patch
new file mode 100644
index 0000000000..79c3d8173d
--- /dev/null
+++ b/gnu/packages/patches/libpaper-free-xdg-config-home.patch
@@ -0,0 +1,37 @@
+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;