NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/51815 ([PATCH] tests/lib/libc/string/t_str{chr,len}: don't leak dlopen'ed handle)



The following reply was made to PR bin/51815; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost,
 dholland%NetBSD.org@localhost
Subject: Re: bin/51815 ([PATCH] tests/lib/libc/string/t_str{chr,len}: don't
 leak dlopen'ed handle)
Date: Tue, 10 Jan 2017 23:32:32 -0800

 --Apple-Mail=_13A5D743-4A39-4F48-8537-A914C8E21692
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8
 
 I forgot to add the other portion of the diff last night when I sent it =
 (the t_strlen part). I=E2=80=99ve attached the second part.
 -Ngie=
 
 --Apple-Mail=_13A5D743-4A39-4F48-8537-A914C8E21692
 Content-Disposition: attachment;
 	filename=t_strlen-dont-leak-the-dlopen_ed-handle.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_strlen-dont-leak-the-dlopen_ed-handle.patch"
 Content-Transfer-Encoding: 7bit
 
 ? obj
 ? string
 ? t_strchr-and-t_strlen-dont-leak-the-dlopen_ed-handle.patch
 ? t_strerror-add-missing-stdio-h-header.patch
 ? t_strlen-dont-leak-the-dlopen_ed-handle.patch
 Index: t_strlen.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/string/t_strlen.c,v
 retrieving revision 1.5
 diff -u -r1.5 t_strlen.c
 --- t_strlen.c	14 Jul 2011 07:33:20 -0000	1.5
 +++ t_strlen.c	11 Jan 2017 07:30:45 -0000
 @@ -40,6 +40,7 @@
  
  ATF_TC_BODY(strlen_basic, tc)
  {
 +	void *dl_handle;
  	/* try to trick the compiler */
  	size_t (*strlen_fn)(const char *);
  
 @@ -107,7 +108,8 @@
  	 * During testing it is useful have the rest of the program
  	 * use a known good version!
  	 */
 -	strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen");
 +	dl_handle = dlopen(NULL, RTLD_LAZY);
 +	strlen_fn = dlsym(dl_handle, "test_strlen");
  	if (!strlen_fn)
  		strlen_fn = strlen;
  
 @@ -134,6 +136,7 @@
  			}
  		}
  	}
 +	(void)dlclose(dl_handle);
  }
  
  ATF_TC(strlen_huge);
 
 --Apple-Mail=_13A5D743-4A39-4F48-8537-A914C8E21692--
 



Home | Main Index | Thread Index | Old Index