Fixed following findings reported by cppcheck

* avr910.c:625 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
	* avr910.c:626 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
	* avr910.c:168 (information) The scope of the variable 'devtype_1st' can be reduced
	* avr910.c:169 (information) The scope of the variable 'dev_supported' can be reduced
	* avrftdi.c:647 (error) Using sizeof for array given as function argument returns the size of pointer.
	* stk500v2.c:3347 (error) Memory leak: b
	* stk500v2.c:3452 (error) Memory leak: b
	* usbasp.c:554 (error) Using sizeof for array given as function argument returns the size of pointer.
	* usbasp.c:485 (information) The scope of the variable 'dly' can be reduced

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1035 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
rliebscher
2012-01-08 17:09:40 +00:00
parent 1c7843a191
commit 9ccde79fde
6 changed files with 38 additions and 12 deletions

View File

@@ -3343,8 +3343,10 @@ static int stk600_xprog_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
return -1;
}
if (stk500v2_loadaddr(pgm, use_ext_addr) < 0)
if (stk500v2_loadaddr(pgm, use_ext_addr) < 0) {
free(b);
return -1;
}
while (n_bytes != 0) {
b[0] = XPRG_CMD_READ_MEM;
@@ -3359,6 +3361,7 @@ static int stk600_xprog_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
fprintf(stderr,
"%s: stk600_xprog_paged_load(): XPRG_CMD_READ_MEM failed\n",
progname);
free(b);
return -1;
}
memcpy(mem->buf + offset, b + 2, page_size);
@@ -3448,8 +3451,10 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
return -1;
}
if (stk500v2_loadaddr(pgm, use_ext_addr) < 0)
if (stk500v2_loadaddr(pgm, use_ext_addr) < 0) {
free(b);
return -1;
}
while (n_bytes != 0) {
if (page_size > 256) {
@@ -3466,6 +3471,7 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
fprintf(stderr,
"%s: stk600_xprog_paged_write(): page size not multiple of 256\n",
progname);
free(b);
return -1;
}
unsigned int chunk;
@@ -3494,6 +3500,7 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
fprintf(stderr,
"%s: stk600_xprog_paged_write(): XPRG_CMD_WRITE_MEM failed\n",
progname);
free(b);
return -1;
}
if (n_bytes < 256)
@@ -3528,6 +3535,7 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
fprintf(stderr,
"%s: stk600_xprog_paged_write(): XPRG_CMD_WRITE_MEM failed\n",
progname);
free(b);
return -1;
}
if (n_bytes < page_size)