close BSDL file upon deinit if it's still open

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1160 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 17 years ago
parent 5f23e7ac5e
commit deff077b4c

@ -1,3 +1,7 @@
2008-04-08 Arnim Laeuger <arniml@users.sourceforge.net>
* src/bsdl/bsdl_flex.l (bsdl_flex_deinit): close file if still open
2008-04-08 Kolja Waschk <kawk>
* src/cmd/idcode.c: [ 1936543 ] Check for set-up cable in idcode (U.Bonnes)

@ -447,6 +447,12 @@ void *bsdl_flex_init(FILE *f, int mode, int debug)
void bsdl_flex_deinit(void *scanner)
{
if (yyget_in(scanner)) {
/* file might still be open so close it in any case
e.g. when a compile error occured and the parser didn't hit EOF/yywrap() */
fclose(yyget_in(scanner));
yyset_in(NULL, scanner);
}
free(yyget_extra(scanner));
yylex_destroy(scanner);
}
@ -495,7 +501,7 @@ void bsdl_flex_switch_file(yyscan_t scanner, char *filename)
/* file in current directory has precedence */
f = fopen(filename, "r");
if (!f) {
char *db_path = jtag_get_data_dir();
const char *db_path = jtag_get_data_dir();
char *db_file;
if ((db_file = (char *)malloc(strlen(db_path) +

Loading…
Cancel
Save