mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-27 02:31:10 -06:00
avrdude: Fix serial port handle leak in many places
This commit is contained in:
parent
a61a72cc94
commit
b7941345d1
5 changed files with 38 additions and 12 deletions
|
|
@ -1695,8 +1695,10 @@ static int stk500v2_open(PROGRAMMER * pgm, char * port)
|
|||
stk500v2_drain(pgm, 0);
|
||||
|
||||
if (pgm->bitclock != 0.0) {
|
||||
if (pgm->set_sck_period(pgm, pgm->bitclock) != 0)
|
||||
if (pgm->set_sck_period(pgm, pgm->bitclock) != 0) {
|
||||
serial_close(&pgm->fd);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -1753,8 +1755,10 @@ static int stk600_open(PROGRAMMER * pgm, char * port)
|
|||
stk500v2_drain(pgm, 0);
|
||||
|
||||
if (pgm->bitclock != 0.0) {
|
||||
if (pgm->set_sck_period(pgm, pgm->bitclock) != 0)
|
||||
if (pgm->set_sck_period(pgm, pgm->bitclock) != 0) {
|
||||
serial_close(&pgm->fd);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue