diff options
author | Remi Collet <remi@remirepo.net> | 2019-09-25 12:59:49 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2019-09-25 12:59:49 +0200 |
commit | ae853c7a30c94a4a647588f8f5b41d4f0bb27f08 (patch) | |
tree | 609c4641c4bb7ac93fd8fa73d2d0c2a54bd16ac8 | |
parent | 223e6be1b1cebd9b1d39a9d2f191e87012f497ce (diff) |
using patch from Fedora
- fix covscan issue - memory leak
- fix file descriptor leak
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | libpaper-covscan.patch | 16 | ||||
-rw-r--r-- | libpaper-file-leak.patch | 22 | ||||
-rw-r--r-- | libpaper.spec | 15 |
4 files changed, 61 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/libpaper-covscan.patch b/libpaper-covscan.patch new file mode 100644 index 0000000..43d0794 --- /dev/null +++ b/libpaper-covscan.patch @@ -0,0 +1,16 @@ +diff --git a/lib/paper.c b/lib/paper.c +index 57db599..8817aea 100644 +--- a/lib/paper.c ++++ b/lib/paper.c +@@ -211,7 +211,10 @@ PAPERSIZEVAR, fall-back to the old behaviour. + fclose(ps); + + paperstr = malloc((strlen(papername) + 1) * sizeof(char)); +- if (! paperstr) return 0; ++ if (! paperstr) { ++ free(papername); ++ return 0; ++ } + + strcpy(paperstr, papername); + free(papername); diff --git a/libpaper-file-leak.patch b/libpaper-file-leak.patch new file mode 100644 index 0000000..47b878b --- /dev/null +++ b/libpaper-file-leak.patch @@ -0,0 +1,22 @@ +diff -up libpaper-1.1.24+nmu5/lib/paper.c.file-leak libpaper-1.1.24+nmu5/lib/paper.c +--- libpaper-1.1.24+nmu5/lib/paper.c.file-leak 2018-03-09 16:21:01.028345956 +0100 ++++ libpaper-1.1.24+nmu5/lib/paper.c 2018-03-09 16:40:57.824279357 +0100 +@@ -140,7 +140,7 @@ char* systempapername(void) { + char* paperstr; + char* paperenv; + const char* paperdef; +- FILE* ps; ++ FILE* ps = NULL; + struct stat statbuf; + const struct paper* pp; + int c; +@@ -224,6 +224,9 @@ PAPERSIZEVAR, fall-back to the old behav + } + } + ++ if (ps) ++ fclose(ps); ++ + paperdef = defaultpapername(); + paperstr = malloc((strlen(paperdef) + 1) * sizeof(char)); + diff --git a/libpaper.spec b/libpaper.spec index 3c36ebd..2eb45be 100644 --- a/libpaper.spec +++ b/libpaper.spec @@ -17,6 +17,13 @@ Patch1: libpaper-1.1.23-debianbug475683.patch # Filed upstream as: # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213 Patch2: libpaper-useglibcfallback.patch +# Memory leak +Patch3: libpaper-file-leak.patch +# memory leak found by covscan, reported to debian upstream +Patch4: libpaper-covscan.patch +# gcc is no longer in buildroot by default +BuildRequires: gcc + BuildRequires: libtool, gettext, gawk %description @@ -41,6 +48,8 @@ to develop applications which use libpaper. %patch0 -p1 -b .automake110 %patch1 -p1 -b .dlfix %patch2 -p1 -b .useglibcfallback +%patch3 -p1 -b .file-leak +%patch4 -p1 -b .covscan libtoolize %build @@ -87,6 +96,12 @@ done %{_mandir}/man3/* %changelog +* Wed Sep 25 2019 Remi Collet <remi@remirepo.net> -1.1.24-8 +- rebuild for remirepo for https://bugzilla.redhat.com/1753534 + using patch from Fedora +- fix covscan issue - memory leak +- fix file descriptor leak + * Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.1.24-8 - Mass rebuild 2014-01-24 |