add dicoS->linecount to safely delete dynrefptr[i],

linecount may change if circuits are changed or deleted.
This commit is contained in:
h_vogt 2016-06-25 14:59:04 +02:00 committed by rlar
parent 2139f328bb
commit 7dd0eaaf8c
2 changed files with 4 additions and 1 deletions

View File

@ -46,6 +46,7 @@ typedef struct { /* the input scanner data structure */
char **dynrefptr;
char *dyncategory;
int hs_compatibility; /* allow extra keywords */
int linecount; /* number of lines in deck */
} dico_t;

View File

@ -456,6 +456,8 @@ nupa_init(char *srcfile)
dicoS->dyncategory[i] = '?';
}
dicoS->linecount = dynmaxline;
if (srcfile != NULL)
scopys(&dicoS->srcfile, srcfile);
}
@ -470,7 +472,7 @@ nupa_del_dicoS(void)
if(!dicoS)
return;
for (i = dynmaxline; i >= 0; i--)
for (i = dicoS->linecount; i >= 0; i--)
txfree(dicoS->dynrefptr[i]);
txfree(dicoS->dynrefptr);