Package: libpaper
Version: 1.1.24+nmu5

When the file /etc/papersize or empty, or contains only comments, the
FILE* for reading /etc/papersize is not closed, before falling back to a
default paper size setting.

A simple patch fixes the issue:

diff --git a/lib/paper.c b/lib/paper.c
index d510c85..6ed735e 100644
--- a/lib/paper.c
+++ b/lib/paper.c
@@ -115,9 +115,9 @@ char* systempapername(void) {
     const char* paperconf;
     char* paperstr;
     char* paperenv;
     const char* paperdef;
-    FILE* ps;
+    FILE* ps = NULL;
     struct stat statbuf;
     const struct paper* pp;
     int c;

@@ -198,9 +198,11 @@ PAPERSIZEVAR, fall-back to the old behaviour.
                    return paperstr;
            }
        }
     }
-
+    if (ps)
+        fclose(ps);
+
     paperdef = defaultpapername();
     paperstr = malloc((strlen(paperdef) + 1) * sizeof(char));

     if (paperstr)

Reply via email to