add dicoS->linecount to safely delete dynrefptr[i],
linecount may change if circuits are changed or deleted.
This commit is contained in:
parent
1066bf0a7b
commit
d89eab99d5
|
|
@ -51,6 +51,7 @@ typedef struct { /* the input scanner data structure */
|
||||||
char **dynrefptr;
|
char **dynrefptr;
|
||||||
char *dyncategory;
|
char *dyncategory;
|
||||||
int hs_compatibility; /* allow extra keywords */
|
int hs_compatibility; /* allow extra keywords */
|
||||||
|
int linecount; /* number of lines in deck */
|
||||||
} dico_t;
|
} dico_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,8 @@ nupa_init(void)
|
||||||
dicoS->dynrefptr[i] = NULL;
|
dicoS->dynrefptr[i] = NULL;
|
||||||
dicoS->dyncategory[i] = '?';
|
dicoS->dyncategory[i] = '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dicoS->linecount = dynmaxline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -332,6 +334,9 @@ nupa_del_dicoS(void)
|
||||||
if(!dicoS)
|
if(!dicoS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for (i = dicoS->linecount; i >= 0; i--)
|
||||||
|
txfree(dicoS->dynrefptr[i]);
|
||||||
|
|
||||||
txfree(dicoS->dynrefptr);
|
txfree(dicoS->dynrefptr);
|
||||||
txfree(dicoS->dyncategory);
|
txfree(dicoS->dyncategory);
|
||||||
txfree(dicoS->inst_name);
|
txfree(dicoS->inst_name);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue