Date: Fri, 16 Aug 2019 15:25:53 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351125 - stable/12/contrib/elftoolchain/readelf Message-ID: <201908161525.x7GFPr6f029128@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Fri Aug 16 15:25:53 2019 New Revision: 351125 URL: https://svnweb.freebsd.org/changeset/base/351125 Log: MFC r350671: readelf: Close input files when done with them. Modified: stable/12/contrib/elftoolchain/readelf/readelf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- stable/12/contrib/elftoolchain/readelf/readelf.c Fri Aug 16 15:24:04 2019 (r351124) +++ stable/12/contrib/elftoolchain/readelf/readelf.c Fri Aug 16 15:25:53 2019 (r351125) @@ -7124,13 +7124,13 @@ dump_object(struct readelf *re) if ((re->elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { warnx("elf_begin() failed: %s", elf_errmsg(-1)); - return; + goto done; } switch (elf_kind(re->elf)) { case ELF_K_NONE: warnx("Not an ELF file."); - return; + goto done; case ELF_K_ELF: dump_elf(re); break; @@ -7139,10 +7139,13 @@ dump_object(struct readelf *re) break; default: warnx("Internal: libelf returned unknown elf kind."); - return; + goto done; } elf_end(re->elf); + +done: + close(fd); } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908161525.x7GFPr6f029128>