Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Mar 2017 18:14:55 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315727 - head/lib/librtld_db
Message-ID:  <201703221814.v2MIEtNM041022@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Mar 22 18:14:55 2017
New Revision: 315727
URL: https://svnweb.freebsd.org/changeset/base/315727

Log:
  Avoid double-closing an fd if elf_begin() fails.
  
  Reported by:	Miles Ohlrich <miles.ohlrich@isilon.com>
  MFC after:	1 week
  Sponsored by:	Dell EMC Isilon

Modified:
  head/lib/librtld_db/rtld_db.c

Modified: head/lib/librtld_db/rtld_db.c
==============================================================================
--- head/lib/librtld_db/rtld_db.c	Wed Mar 22 18:13:14 2017	(r315726)
+++ head/lib/librtld_db/rtld_db.c	Wed Mar 22 18:14:55 2017	(r315727)
@@ -275,10 +275,8 @@ rtld_syms(rd_agent_t *rdap, const char *
 	if (elf_version(EV_CURRENT) == EV_NONE)
 		goto err;
 	e = elf_begin(fd, ELF_C_READ, NULL);
-	if (e == NULL) {
-		close(fd);
+	if (e == NULL)
 		goto err;
-	}
 
 	scn = NULL;
 	while ((scn = elf_nextscn(e, scn)) != NULL) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703221814.v2MIEtNM041022>