commit: ac373d7fa13ca22ff8db50bd147aa8ef4aeef4e3 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Mon Jun 20 02:59:49 2016 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Mon Jun 20 02:59:49 2016 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=ac373d7f
scanelf: enable cleanup for coverity porting.h | 4 ++++ scanelf.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/porting.h b/porting.h index c0d5ebc..2d79f28 100644 --- a/porting.h +++ b/porting.h @@ -83,6 +83,10 @@ #ifdef __SANITIZE_ADDRESS__ # define PAX_UTILS_CLEANUP 1 #endif +/* Coverity catches some things we leak on purpose. */ +#ifdef __COVERITY__ +# define PAX_UTILS_CLEANUP 1 +#endif #ifndef PAX_UTILS_CLEANUP # define PAX_UTILS_CLEANUP 0 #endif diff --git a/scanelf.c b/scanelf.c index 57c5156..1f3e356 100644 --- a/scanelf.c +++ b/scanelf.c @@ -2569,6 +2569,9 @@ static void cleanup(void) free(qa_textrels); free(qa_execstack); free(qa_wx_load); + + if (root_fd != AT_FDCWD) + close(root_fd); } int main(int argc, char *argv[])