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:
Rene Liebscher
2012-01-08 17:09:40 +00:00
parent 0b3feb71b8
commit d34978a124
6 changed files with 38 additions and 12 deletions

View File

@@ -165,8 +165,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
char hw[2];
char buf[10];
char type;
char c, devtype_1st;
int dev_supported = 0;
char c;
AVRPART * part;
/* Get the programmer identifier. Programmer returns exactly 7 chars
@@ -223,6 +222,8 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
}
if (PDATA(pgm)->devcode == 0) {
char devtype_1st;
int dev_supported = 0;
/* Get list of devices that the programmer supports. */
@@ -614,14 +615,15 @@ static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
unsigned int blocksize = PDATA(pgm)->buffersize;
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
rval = -2;
return -2;
if (m->desc[0] == 'e')
blocksize = 1; /* Write to eeprom single bytes only */
avr910_set_addr(pgm, addr);
cmd = malloc(4 + blocksize);
if (!cmd) rval = -1;
if (!cmd) return -1;
cmd[0] = 'B';
cmd[3] = toupper((int)(m->desc[0]));