Fix memory leaks
Free buf in the case of an error. Found via cppcheck.
This commit is contained in:
parent
3d39f3f232
commit
d14bb02dca
|
@ -430,6 +430,7 @@ int jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
|||
if (serial_send(&pgm->fd, buf, len + 4) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_send(): failed to send command to serial port\n",
|
||||
progname);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,6 +214,7 @@ static int jtagmkI_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
|||
if (serial_send(&pgm->fd, buf, len + 2) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkI_send(): failed to send command to serial port\n",
|
||||
progname);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue