avrdude: Fix serial port handle leak in many places

This commit is contained in:
Vojtech Kral 2019-02-27 16:32:17 +01:00
parent a61a72cc94
commit b7941345d1
5 changed files with 38 additions and 12 deletions

View file

@ -669,11 +669,15 @@ static int stk500_open(PROGRAMMER * pgm, char * port)
// MIB510 init
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0 &&
mib510_isp(pgm, 1) != 0)
mib510_isp(pgm, 1) != 0) {
serial_close(&pgm->fd);
return -1;
}
if (stk500_getsync(pgm) < 0)
if (stk500_getsync(pgm) < 0) {
serial_close(&pgm->fd);
return -1;
}
return 0;
}