Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): remove ineffective malloc_options vari...



details:   https://anonhg.NetBSD.org/src/rev/ab3da2e66f22
branches:  trunk
changeset: 975514:ab3da2e66f22
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 30 13:53:02 2020 +0000

description:
make(1): remove ineffective malloc_options variable

According to jemalloc(3), the variable must be called _malloc_options,
with a leading underscore, to have an effect.

Renaming the variable indeed enables the option.  There's not much point
having this variable around though, since it neither detects a trivial
double-free nor freeing an invalid pointer in the following code
snippet:

        char *asdf = bmake_malloc(10);
        fprintf(stderr, "%c\n", *asdf);
        free(asdf + 8);
        free(asdf);
        free(asdf);
        exit(1);

Instead, it just crashes with a segmentation fault.

diffstat:

 usr.bin/make/job.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r b73d98fff4da -r ab3da2e66f22 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sun Aug 30 11:16:17 2020 +0000
+++ b/usr.bin/make/job.c        Sun Aug 30 13:53:02 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.225 2020/08/30 11:12:05 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.226 2020/08/30 13:53:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.225 2020/08/30 11:12:05 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.226 2020/08/30 13:53:02 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c      8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.225 2020/08/30 11:12:05 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.226 2020/08/30 13:53:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -352,8 +352,6 @@
 static void JobSigUnlock(sigset_t *);
 static void JobSigReset(void);
 
-const char *malloc_options MAKE_ATTR_UNUSED = "A"; /* see jemalloc(3) */
-
 static unsigned
 nfds_per_job(void)
 {



Home | Main Index | Thread Index | Old Index