Merge pull request #779 from yegorich/memleaks
Fix memory leaks In jtag3_send() and jtagmkI_send(), free the buffer when returning an error.
This commit is contained in:
commit
c60c5c4b83
|
@ -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