(Partially) submitted by John Voltz:

bug #20004: AVRDUDE update (-U) operations do not close files
* fileio.c (fmt_autodetect, fileio): fclose() files.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@801 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2009-02-19 10:49:55 +00:00
parent 0c29ebc694
commit 1a3155dd75
2 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2009-02-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
(Partially) submitted by John Voltz:
bug #20004: AVRDUDE update (-U) operations do not close files
* fileio.c (fmt_autodetect, fileio): fclose() files.
2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de> 2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbtiny.c: Replace all but one (very unlikely to trigger) exit(1) * usbtiny.c: Replace all but one (very unlikely to trigger) exit(1)

View File

@ -969,8 +969,10 @@ static int fmt_autodetect(char * fname)
break; break;
} }
} }
if (found) if (found) {
fclose(f);
return FMT_RBIN; return FMT_RBIN;
}
/* check for lines that look like intel hex */ /* check for lines that look like intel hex */
if ((buf[0] == ':') && (len >= 11)) { if ((buf[0] == ':') && (len >= 11)) {
@ -981,8 +983,10 @@ static int fmt_autodetect(char * fname)
break; break;
} }
} }
if (found) if (found) {
fclose(f);
return FMT_IHEX; return FMT_IHEX;
}
} }
/* check for lines that look like motorola s-record */ /* check for lines that look like motorola s-record */
@ -994,11 +998,14 @@ static int fmt_autodetect(char * fname)
break; break;
} }
} }
if (found) if (found) {
fclose(f);
return FMT_SREC; return FMT_SREC;
}
} }
} }
fclose(f);
return -1; return -1;
} }
@ -1143,7 +1150,9 @@ int fileio(int op, char * filename, FILEFMT format,
rc = avr_mem_hiaddr(mem); rc = avr_mem_hiaddr(mem);
} }
} }
if (format != FMT_IMM) {
fclose(f);
}
return rc; return rc;
} }