diff --git a/lib/asn1/gen.c b/lib/asn1/gen.c index 8181c1e83..fffacffbc 100644 --- a/lib/asn1/gen.c +++ b/lib/asn1/gen.c @@ -356,11 +356,19 @@ close_generate (void) err(1, "writes to private header file failed"); if (templatefile && fclose(templatefile) == EOF) err(1, "writes to template file failed"); - if (logfile) { - fprintf(logfile, "\n"); - if (fclose(logfile) == EOF) - err(1, "writes to log file failed"); - } + if (!jsonfile) abort(); + if (fclose(jsonfile) == EOF) + err(1, "writes to JSON file failed"); + if (!oidsfile) abort(); + if (fclose(oidsfile) == EOF) + err(1, "writes to OIDs file failed"); + if (!symsfile) abort(); + if (fclose(symsfile) == EOF) + err(1, "writes to symbols file failed"); + if (!logfile) abort(); + fprintf(logfile, "\n"); + if (fclose(logfile) == EOF) + err(1, "writes to log file failed"); } void diff --git a/lib/asn1/main.c b/lib/asn1/main.c index 64db63ab2..1186648f6 100644 --- a/lib/asn1/main.c +++ b/lib/asn1/main.c @@ -316,12 +316,12 @@ main(int argc, char **argv) exit(1); if (!original_order) generate_types(); - close_generate (); if (argc != optidx) fclose(yyin); if (one_code_file) close_codefile(); + close_generate(); if (arg) { for (i = 1; i < len; i++)