ref: 8fd1d697664f780b8adac60cb236d2f08f546f9b
parent: f3d9187d4e0f02294fb1b0e31152070506314e67
parent: f009bd339788ee01539a74b68a9daf59969163bf
author: ozan yigit <ozan.yigit@gmail.com>
date: Mon May 30 07:33:58 EDT 2022
resolved conflicts in description, release date.
--- a/FIXES
+++ b/FIXES
@@ -25,10 +25,16 @@
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
+
+May 23, 2022:
+ Memory leak when assigning a string to some of the built-in
+ variables. allocated string erroneously marked DONTFREE.
+ Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>.
+
Mar 14, 2022:
- The fulfillment of an assignment operand had been truncating its
- entry in ARGV (since circa 1989). Thanks to Miguel Pineiro Jr.
- <mpj@pineiro.cc>.
+ Historic bug: command-line "name=value" assignment had been
+ truncating its entry in ARGV. (circa 1989) Thanks to
+ Miguel Pineiro Jr. <mpj@pineiro.cc>.
Mar 3, 2022:
Fixed file management memory leak that appears to have been
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20220314";
+const char *version = "version 20220530";
#define DEBUG
#include <stdio.h>
--- a/tran.c
+++ b/tran.c
@@ -70,18 +70,6 @@
extern Cell **fldtab;
-static void
-setfree(Cell *vp)
-{- if (&vp->sval == FS || &vp->sval == RS ||
- &vp->sval == OFS || &vp->sval == ORS ||
- &vp->sval == OFMT || &vp->sval == CONVFMT ||
- &vp->sval == FILENAME || &vp->sval == SUBSEP)
- vp->tval |= DONTFREE;
- else
- vp->tval &= ~DONTFREE;
-}
-
void syminit(void) /* initialize symbol table with builtin vars */
{ literal0 = setsymtab("0", "0", 0.0, NUM|STR|CON|DONTFREE, symtab);@@ -377,10 +365,9 @@
t = s ? tostring(s) : tostring(""); /* in case it's self-assign */if (freeable(vp))
xfree(vp->sval);
- vp->tval &= ~(NUM|CONVC|CONVO);
+ vp->tval &= ~(NUM|DONTFREE|CONVC|CONVO);
vp->tval |= STR;
vp->fmt = NULL;
- setfree(vp);
DPRINTF("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n",(void*)vp, NN(vp->nval), t, (void*)t, vp->tval, donerec, donefld);
vp->sval = t;
--
⑨