This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=31ba2b1b10cfcc2149bb43fe9b918355177e4341

commit 31ba2b1b10cfcc2149bb43fe9b918355177e4341
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Tue Jun 5 05:36:23 2018 +0200

    s-s-d: Do not leak a file descriptor on AIX
    
    Warned-by: cppcheck
---
 debian/changelog          |  1 +
 utils/start-stop-daemon.c | 10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 661f739c9..35de1e660 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -89,6 +89,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
     - Use MD5_CTX instead of struct MD5Context, as the prevalent more portable
       type on system's <md5.h> headers.
     - Check for ldconfig command in dpkg only on platforms that do have it.
+    - Fix file descriptor leak in start-stop-daemon on AIX.
   * Perl modules:
     - Check that $tarname is defined before use in Dpkg::Source::Package::V1.
       Thanks to Christoph Biedl <debian.a...@manchmal.in-ulm.de>.
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 6d04c674e..e9720425a 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1309,10 +1309,16 @@ proc_get_psinfo(pid_t pid, struct psinfo *psinfo)
        fp = fopen(filename, "r");
        if (!fp)
                return false;
-       if (fread(psinfo, sizeof(*psinfo), 1, fp) == 0)
+       if (fread(psinfo, sizeof(*psinfo), 1, fp) == 0) {
+               fclose(fp);
                return false;
-       if (ferror(fp))
+       }
+       if (ferror(fp)) {
+               fclose(fp);
                return false;
+       }
+
+       fclose(fp);
 
        return true;
 }

-- 
Dpkg.Org's dpkg

Reply via email to