X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/d6b2ae5fa68b9a82ffc006c233aef64c5cdb3bd2..e56972cabb200aa655374e95bbbbcf18d0ddabe0:/uip/mhlsbr.c diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index 28d48947..9a35a816 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -875,14 +875,18 @@ parse (void) static void process (char *folder, char *fname, int ofilen, int ofilec) { - char *cp = NULL; - FILE *fp = NULL; + /* static to prevent "might be clobbered" warning from gcc 4.9.2: */ + static char *cp; + static FILE *fp; struct mcomp *c1; struct stat st; struct arglist *ap; /* volatile to prevent "might be clobbered" warning from gcc: */ char *volatile fname2 = fname ? fname : "(stdin)"; + cp = NULL; + fp = NULL; + switch (setjmp (env)) { case OK: if (fname) { @@ -904,6 +908,7 @@ process (char *folder, char *fname, int ofilen, int ofilec) if (ontty != PITTY) SIGNAL (SIGINT, intrser); mhlfile (fp, cp, ofilen, ofilec); /* FALL THROUGH! */ + free (cp); for (ap = arglist_head; ap; ap = ap->a_next) { fmt_free(ap->a_fmt, 0); @@ -913,12 +918,11 @@ process (char *folder, char *fname, int ofilen, int ofilec) if (arglist_head) fmt_free(NULL, 1); - default: + default: if (ontty != PITTY) SIGNAL (SIGINT, SIG_IGN); - if (mhl_action == NULL && fp != stdin) + if (mhl_action == NULL && fp != stdin && fp != NULL) fclose (fp); - free (cp); if (holder.c_text) { free (holder.c_text); holder.c_text = NULL;