patch #9819: Address several leaks in SVN rev 1429
Submitted by Adrian Klieber git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1435 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
c34fb88844
commit
785b0cea55
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2020-03-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
|
Submitted by Adrian Klieber:
|
||||||
|
patch #9819: Address several leaks in SVN rev 1429
|
||||||
|
* config.c: Fix potential memory leak
|
||||||
|
* jtagmkII.c: (Dito.)
|
||||||
|
* stk500v2.c: (Dito.)
|
||||||
|
* update.c: (Dito.)
|
||||||
|
* windows/loaddrv.c: Fix file descriptor leak.
|
||||||
|
|
||||||
2020-03-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
2020-03-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
Submitted by: kautism
|
Submitted by: kautism
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -69,6 +69,7 @@ Current:
|
||||||
patch #9735: spelling error fix: psuedo -> pseudo
|
patch #9735: spelling error fix: psuedo -> pseudo
|
||||||
patch #9728: Fix UsbTiny programmer
|
patch #9728: Fix UsbTiny programmer
|
||||||
patch #9893: [PATCH] Reader reads ftdi handle after main thread close it
|
patch #9893: [PATCH] Reader reads ftdi handle after main thread close it
|
||||||
|
patch #9819: Address several leaks in SVN rev 1429
|
||||||
|
|
||||||
* Internals:
|
* Internals:
|
||||||
- New avrdude.conf keyword "family_id", used to verify SIB attributes
|
- New avrdude.conf keyword "family_id", used to verify SIB attributes
|
||||||
|
|
2
config.c
2
config.c
|
@ -217,6 +217,7 @@ TOKEN * hexnumber(char * text)
|
||||||
tkn->value.number = strtoul(text, &e, 16);
|
tkn->value.number = strtoul(text, &e, 16);
|
||||||
if ((e == text) || (*e != 0)) {
|
if ((e == text) || (*e != 0)) {
|
||||||
yyerror("can't scan hex number \"%s\"", text);
|
yyerror("can't scan hex number \"%s\"", text);
|
||||||
|
free_token(tkn);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +245,7 @@ TOKEN * string(char * text)
|
||||||
tkn->value.string = (char *) malloc(len+1);
|
tkn->value.string = (char *) malloc(len+1);
|
||||||
if (tkn->value.string == NULL) {
|
if (tkn->value.string == NULL) {
|
||||||
yyerror("string(): out of memory");
|
yyerror("string(): out of memory");
|
||||||
|
free_token(tkn);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(tkn->value.string, text);
|
strcpy(tkn->value.string, text);
|
||||||
|
|
|
@ -604,6 +604,7 @@ static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg,
|
||||||
if (tnow - tstart > timeoutval) {
|
if (tnow - tstart > timeoutval) {
|
||||||
avrdude_message(MSG_INFO, "%s: jtagmkII_recv_frame(): timeout\n",
|
avrdude_message(MSG_INFO, "%s: jtagmkII_recv_frame(): timeout\n",
|
||||||
progname);
|
progname);
|
||||||
|
free(buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,6 +742,7 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||||
avrdude_message(MSG_NOTICE, "Device ID: %s\n",
|
avrdude_message(MSG_NOTICE, "Device ID: %s\n",
|
||||||
resp + 16);
|
resp + 16);
|
||||||
}
|
}
|
||||||
|
free(resp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(resp);
|
free(resp);
|
||||||
|
@ -3634,12 +3636,12 @@ static int jtagmkII_paged_write32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||||
status = jtagmkII_flash_write_page32(pgm, pageNum);
|
status = jtagmkII_flash_write_page32(pgm, pageNum);
|
||||||
if(status < 0) {lineno = __LINE__; goto eRR;}
|
if(status < 0) {lineno = __LINE__; goto eRR;}
|
||||||
}
|
}
|
||||||
free(cmd);
|
|
||||||
serial_recv_timeout = otimeout;
|
serial_recv_timeout = otimeout;
|
||||||
|
|
||||||
status = jtagmkII_reset32(pgm, AVR32_SET4RUNNING); // AVR32_SET4RUNNING | AVR32_RELEASE_JTAG
|
status = jtagmkII_reset32(pgm, AVR32_SET4RUNNING); // AVR32_SET4RUNNING | AVR32_RELEASE_JTAG
|
||||||
if(status < 0) {lineno = __LINE__; goto eRR;}
|
if(status < 0) {lineno = __LINE__; goto eRR;}
|
||||||
|
|
||||||
|
free(cmd);
|
||||||
return addr;
|
return addr;
|
||||||
|
|
||||||
eRR:
|
eRR:
|
||||||
|
|
|
@ -348,6 +348,9 @@ static void stk500v2_jtagmkII_teardown(PROGRAMMER * pgm)
|
||||||
{
|
{
|
||||||
void *mycookie;
|
void *mycookie;
|
||||||
|
|
||||||
|
free(PDATA(pgm)->flash_pagecache);
|
||||||
|
free(PDATA(pgm)->eeprom_pagecache);
|
||||||
|
|
||||||
mycookie = pgm->cookie;
|
mycookie = pgm->cookie;
|
||||||
pgm->cookie = PDATA(pgm)->chained_pdata;
|
pgm->cookie = PDATA(pgm)->chained_pdata;
|
||||||
jtagmkII_teardown(pgm);
|
jtagmkII_teardown(pgm);
|
||||||
|
@ -570,6 +573,7 @@ static int stk500v2_jtagmkII_recv(PROGRAMMER * pgm, unsigned char *msg,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(msg, jtagmsg + 1, rv - 1);
|
memcpy(msg, jtagmsg + 1, rv - 1);
|
||||||
|
free(jtagmsg);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
update.c
3
update.c
|
@ -348,6 +348,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
|
||||||
avrdude_message(MSG_INFO, "%s: failed to read all of %s memory, rc=%d\n",
|
avrdude_message(MSG_INFO, "%s: failed to read all of %s memory, rc=%d\n",
|
||||||
progname, mem->desc, rc);
|
progname, mem->desc, rc);
|
||||||
pgm->err_led(pgm, ON);
|
pgm->err_led(pgm, ON);
|
||||||
|
avr_free_part(v);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
report_progress (1,1,NULL);
|
report_progress (1,1,NULL);
|
||||||
|
@ -362,6 +363,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
|
||||||
avrdude_message(MSG_INFO, "%s: verification error; content mismatch\n",
|
avrdude_message(MSG_INFO, "%s: verification error; content mismatch\n",
|
||||||
progname);
|
progname);
|
||||||
pgm->err_led(pgm, ON);
|
pgm->err_led(pgm, ON);
|
||||||
|
avr_free_part(v);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,6 +373,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
|
||||||
}
|
}
|
||||||
|
|
||||||
pgm->vfy_led(pgm, OFF);
|
pgm->vfy_led(pgm, OFF);
|
||||||
|
avr_free_part(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
avrdude_message(MSG_INFO, "%s: invalid update operation (%d) requested\n",
|
avrdude_message(MSG_INFO, "%s: invalid update operation (%d) requested\n",
|
||||||
|
|
|
@ -45,6 +45,7 @@ void DisplayErrorText(DWORD dwLastError) {
|
||||||
int exists(char *filename) {
|
int exists(char *filename) {
|
||||||
FILE * pFile;
|
FILE * pFile;
|
||||||
pFile = fopen(filename, "r");
|
pFile = fopen(filename, "r");
|
||||||
|
if (pFile) fclose(pFile);
|
||||||
return pFile != NULL;
|
return pFile != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue