Index: include/stdlib.h =================================================================== RCS file: /cvsroot/src/include/stdlib.h,v retrieving revision 1.121 diff -u -r1.121 stdlib.h --- include/stdlib.h 5 Jan 2019 09:16:46 -0000 1.121 +++ include/stdlib.h 12 Sep 2019 23:40:14 -0000 @@ -129,6 +129,10 @@ #endif int system(const char *); +#if defined(_NETBSD_SOURCE) +void __suppress_leak(void *); +#endif + /* These are currently just stubs. */ int mblen(const char *, size_t); size_t mbstowcs(wchar_t * __restrict, const char * __restrict, size_t); Index: lib/libc/stdlib/Makefile.inc =================================================================== RCS file: /cvsroot/src/lib/libc/stdlib/Makefile.inc,v retrieving revision 1.95 diff -u -r1.95 Makefile.inc --- lib/libc/stdlib/Makefile.inc 4 Mar 2019 17:30:33 -0000 1.95 +++ lib/libc/stdlib/Makefile.inc 12 Sep 2019 23:40:15 -0000 @@ -4,7 +4,8 @@ # stdlib sources .PATH: ${ARCHDIR}/stdlib ${.CURDIR}/stdlib -SRCS+= _env.c _rand48.c \ +SRCS+= __suppress_leak.c \ + _env.c _rand48.c \ a64l.c abort.c atexit.c atof.c atoi.c atol.c atoll.c \ bsearch.c cxa_thread_atexit.c drand48.c exit.c \ getenv.c getopt.c getopt_long.c getsubopt.c \ Index: lib/libc/stdlib/__suppress_leak.c =================================================================== RCS file: lib/libc/stdlib/__suppress_leak.c diff -N lib/libc/stdlib/__suppress_leak.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/stdlib/__suppress_leak.c 12 Sep 2019 23:40:15 -0000 @@ -0,0 +1,49 @@ +/* $NetBSD$ */ + +/*- + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD$"); +#endif /* LIBC_SCCS and not lint */ + +/* + * Stubs for thread operations, for use when leak detectors are not used by + * the application. + */ + +void __libc_suppress_leak(void *p); + +__weak_alias(__suppress_leak, __libc_suppress_leak) + +void +__libc_suppress_leak(void *p) +{ + + __USE(p); +}