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 Holger Vogt
parent 1066bf0a7b
commit d89eab99d5
2 changed files with 6 additions and 0 deletions

View File

@ -51,6 +51,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

@ -320,6 +320,8 @@ nupa_init(void)
dicoS->dynrefptr[i] = NULL;
dicoS->dyncategory[i] = '?';
}
dicoS->linecount = dynmaxline;
}
@ -332,6 +334,9 @@ nupa_del_dicoS(void)
if(!dicoS)
return;
for (i = dicoS->linecount; i >= 0; i--)
txfree(dicoS->dynrefptr[i]);
txfree(dicoS->dynrefptr);
txfree(dicoS->dyncategory);
txfree(dicoS->inst_name);