diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2020-07-03 11:16:02 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2020-07-03 11:16:02 +0300 |
commit | f60ced696bc752cdc1a1f45ce2cc9d6149be7087 (patch) | |
tree | a6294c9607f4964212c10daa3b1dde3501bf4d86 | |
parent | c93888d0bc6a1170edaac3f8cee4e13aac2abda9 (diff) | |
download | egawk-f60ced696bc752cdc1a1f45ce2cc9d6149be7087.tar.gz egawk-f60ced696bc752cdc1a1f45ce2cc9d6149be7087.tar.bz2 egawk-f60ced696bc752cdc1a1f45ce2cc9d6149be7087.zip |
Fix double free error with -M.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | field.c | 8 |
2 files changed, 17 insertions, 0 deletions
@@ -1,3 +1,12 @@ +2020-07-03 Arnold D. Robbins <arnold@skeeve.com> + + Fix a double free error with -M. Thanks to + "NIDE, Naoyuki" <nide@ics.nara-wu.ac.jp> for the report. + + * field.c (clear_mpfr): New macro, clears MPFR and NUMCUR bits. + (reset_record): Use it on the newly copied field values. + (purge_record): Add introductory comment since we're in the file. + 2020-07-01 Arnold D. Robbins <arnold@skeeve.com> * eval.c (posix_compare): Rewrite contributed by @@ -90,6 +90,8 @@ Regexp *FPAT_re_no_case = NULL; Regexp *FPAT_regexp = NULL; NODE *Null_field = NULL; +#define clear_mpfr(n) ((n)->flags &= ~(MPFN | MPZN | NUMCUR)) + /* init_fields --- set up the fields array to start with */ void @@ -230,6 +232,7 @@ rebuild_record() } n->stptr = cops; + clear_mpfr(n); unref(r); fields_arr[i] = n; assert((n->flags & WSTRCUR) == 0); @@ -347,6 +350,11 @@ reset_record() } } +/* + * purge_record --- throw away the fields, make sure that + * individual nodes remain valid. + */ + static void purge_record() { |