Close dangling file handle
git-svn-id: svn://svn.berlios.de/openocd/trunk@616 b42882b7-edfa-0310-969c-e2dbd0fdcd60__archive__
parent
040e254243
commit
9334cd451b
|
@ -478,7 +478,7 @@ int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *
|
||||||
p = get_flash_bank_by_addr(target, address);
|
p = get_flash_bank_by_addr(target, address);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We can't know if we did a resume + halt, in which case we no longer know the erased state */
|
/* We can't know if we did a resume + halt, in which case we no longer know the erased state */
|
||||||
|
|
|
@ -57,15 +57,19 @@ static int autodetect_image_type(image_t *image, char *url)
|
||||||
{
|
{
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
if ((retval = fileio_read(&fileio, 9, buffer, &read_bytes)) != ERROR_OK)
|
retval = fileio_read(&fileio, 9, buffer, &read_bytes);
|
||||||
|
|
||||||
|
if (retval==ERROR_OK)
|
||||||
{
|
{
|
||||||
return ERROR_FILEIO_OPERATION_FAILED;
|
if (read_bytes != 9)
|
||||||
}
|
{
|
||||||
if (read_bytes != 9)
|
retval=ERROR_FILEIO_OPERATION_FAILED;
|
||||||
{
|
}
|
||||||
return ERROR_FILEIO_OPERATION_FAILED;
|
|
||||||
}
|
}
|
||||||
fileio_close(&fileio);
|
fileio_close(&fileio);
|
||||||
|
|
||||||
|
if (retval!=ERROR_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
/* check header against known signatures */
|
/* check header against known signatures */
|
||||||
if (strncmp((char*)buffer,ELFMAG,SELFMAG)==0)
|
if (strncmp((char*)buffer,ELFMAG,SELFMAG)==0)
|
||||||
|
|
Loading…
Reference in New Issue