Hello, The free() at the top of dounsetenv() in csh(1) isn't needed because name is always freed before returning at bottom of function. Also, name itself is never returned so it doesn't need to be static.
./csh setenv HEY YU unsetenv HEY printenv I ran the above and it seems to work the same as before. - Michael Index: func.c =================================================================== RCS file: /cvs/src/bin/csh/func.c,v retrieving revision 1.36 diff -u -p -u -r1.36 func.c --- func.c 16 Dec 2017 10:27:21 -0000 1.36 +++ func.c 17 Dec 2017 09:41:01 -0000 @@ -924,11 +924,9 @@ void /*ARGSUSED*/ dounsetenv(Char **v, struct command *t) { - Char **ep, *p, *n; + Char **ep, *p, *n, *name; int i, maxi; - static Char *name = NULL; - free(name); /* * Find the longest environment variable */