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): free the variable names given on the c...



details:   https://anonhg.NetBSD.org/src/rev/2b0e03c4c523
branches:  trunk
changeset: 941696:2b0e03c4c523
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Oct 27 07:51:43 2020 +0000

description:
make(1): free the variable names given on the command line

These are not aliased anywhere.  The opts.makefiles on the other hand
may be referenced in GNode.fname or pretty much anywhere else, so don't
free them.  There's still a Targ_PrintGraph call below it that might use
them.

diffstat:

 usr.bin/make/main.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r f2421120556d -r 2b0e03c4c523 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Tue Oct 27 07:44:43 2020 +0000
+++ b/usr.bin/make/main.c       Tue Oct 27 07:51:43 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.400 2020/10/27 07:44:43 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.401 2020/10/27 07:51:43 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.400 2020/10/27 07:44:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.401 2020/10/27 07:51:43 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -1528,8 +1528,8 @@
        }
 
 #ifdef CLEANUP
-       Lst_Free(opts.variables);
-       Lst_Free(opts.makefiles);
+       Lst_Destroy(opts.variables, free);
+       Lst_Free(opts.makefiles);       /* don't free, may be used in GNodes */
        Lst_Destroy(opts.create, free);
 #endif
 



Home | Main Index | Thread Index | Old Index