-/* $OpenBSD: FIXES,v 1.43 2022/01/27 16:58:37 millert Exp $ */
+/* $OpenBSD: FIXES,v 1.44 2022/06/03 19:40:56 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
+Mar 3, 2022:
+ Fixed file management memory leak that appears to have been
+ there since the files array was first initialized with stdin,
+ stdout, and stderr (circa 1992). Thanks to Miguel Pineiro Jr.
+ <mpj@pineiro.cc>.
+
December 8, 2021:
The error handling in closefile and closeall was mangled. Long
standing warnings had been made fatal and some fatal errors went
-/* $OpenBSD: main.c,v 1.51 2022/01/27 16:58:37 millert Exp $ */
+/* $OpenBSD: main.c,v 1.52 2022/06/03 19:40:56 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20211208";
+const char *version = "version 20220303";
#define DEBUG
#include <stdio.h>
-/* $OpenBSD: run.c,v 1.71 2022/01/27 16:58:37 millert Exp $ */
+/* $OpenBSD: run.c,v 1.72 2022/06/03 19:40:56 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
if (files == NULL)
FATAL("can't allocate file memory for %zu files", nfiles);
files[0].fp = stdin;
- files[0].fname = "/dev/stdin";
+ files[0].fname = tostring("/dev/stdin");
files[0].mode = LT;
files[1].fp = stdout;
- files[1].fname = "/dev/stdout";
+ files[1].fname = tostring("/dev/stdout");
files[1].mode = GT;
files[2].fp = stderr;
- files[2].fname = "/dev/stderr";
+ files[2].fname = tostring("/dev/stderr");
files[2].mode = GT;
}
stat = fclose(files[i].fp) == EOF;
if (stat)
WARNING("i/o error occurred closing %s", files[i].fname);
- if (i > 2) /* don't do /dev/std... */
- xfree(files[i].fname);
+ xfree(files[i].fname);
files[i].fname = NULL; /* watch out for ref thru this */
files[i].fp = NULL;
break;