aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-06-19 22:59:49 -0400
committerMike Frysinger <vapier@gentoo.org>2016-06-19 22:59:49 -0400
commitac373d7fa13ca22ff8db50bd147aa8ef4aeef4e3 (patch)
tree13d79854e137c60a7b7aef783f75aedeec01d0d9
parentpspax: fix file leakage when reading the command line (diff)
downloadpax-utils-ac373d7fa13ca22ff8db50bd147aa8ef4aeef4e3.tar.gz
pax-utils-ac373d7fa13ca22ff8db50bd147aa8ef4aeef4e3.tar.bz2
pax-utils-ac373d7fa13ca22ff8db50bd147aa8ef4aeef4e3.zip
scanelf: enable cleanup for coverity
-rw-r--r--porting.h4
-rw-r--r--scanelf.c3
2 files changed, 7 insertions, 0 deletions
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[])