Merge pull request from melloc/fields-init

Fix initial "fields" buffer size
This commit is contained in:
onetrueawk 2019-01-21 14:12:05 -05:00 committed by GitHub
commit f70e36869e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
lib.c
View File

@ -59,7 +59,7 @@ void recinit(unsigned int n)
{
if ( (record = (char *) malloc(n)) == NULL
|| (fields = (char *) malloc(n+1)) == NULL
|| (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL
|| (fldtab = (Cell **) malloc((nfields+2) * sizeof(Cell *))) == NULL
|| (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL )
FATAL("out of space for $0 and fields");
*fldtab[0] = dollar0;