=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/run.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- src/usr.bin/awk/run.c 2022/06/03 19:40:56 1.72 +++ src/usr.bin/awk/run.c 2022/09/01 15:21:28 1.73 @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.72 2022/06/03 19:40:56 millert Exp $ */ +/* $OpenBSD: run.c,v 1.73 2022/09/01 15:21:28 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -972,8 +972,10 @@ } *p = '\0'; free(fmt); - for ( ; a; a = a->nnext) /* evaluate any remaining args */ - execute(a); + for ( ; a; a = a->nnext) { /* evaluate any remaining args */ + x = execute(a); + tempfree(x); + } *pbuf = buf; *pbufsize = bufsize; return p - buf; @@ -1269,6 +1271,7 @@ origs = s = strdup(getsval(y)); if (s == NULL) FATAL("out of space in split"); + tempfree(y); arg3type = ptoi(a[3]); if (a[2] == NULL) /* fs string */ fs = getsval(fsloc); @@ -1391,7 +1394,6 @@ } } tempfree(ap); - tempfree(y); xfree(origs); xfree(origfs); x = gettemp(); @@ -1836,8 +1838,10 @@ setfval(x, u); if (nextarg != NULL) { WARNING("warning: function has too many arguments"); - for ( ; nextarg; nextarg = nextarg->nnext) - execute(nextarg); + for ( ; nextarg; nextarg = nextarg->nnext) { + y = execute(nextarg); + tempfree(y); + } } return(x); }