summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-12-12 20:13:50 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-12-12 20:13:50 +0000
commitf6ac3ec7edfe96acb013d2036f5ded9a8cb0d38c (patch)
tree98aee16c8fc407f4b8afe371dd00739244db6f36
parent90bcf9be5ec65894fa75bfc546c6d2a8365ec899 (diff)
downloadrockbox-f6ac3ec7edfe96acb013d2036f5ded9a8cb0d38c.tar.gz
rockbox-f6ac3ec7edfe96acb013d2036f5ded9a8cb0d38c.tar.bz2
rockbox-f6ac3ec7edfe96acb013d2036f5ded9a8cb0d38c.zip
Fix array sizes
Fix some error handling git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19406 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/jz4740_tools/jz4740_usbtool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/jz4740_tools/jz4740_usbtool.c b/utils/jz4740_tools/jz4740_usbtool.c
index 74372aa632..1fdb8f4d46 100644
--- a/utils/jz4740_tools/jz4740_usbtool.c
+++ b/utils/jz4740_tools/jz4740_usbtool.c
@@ -159,7 +159,7 @@ int filesize(FILE* fd)
int upload_app(usb_dev_handle* dh, int address, unsigned char* p, int len, bool stage2)
{
int err;
- char buf[8];
+ char buf[9];
unsigned char* tmp_buf;
fprintf(stderr, "[INFO] GET_CPU_INFO: ");
@@ -207,7 +207,7 @@ int upload_app(usb_dev_handle* dh, int address, unsigned char* p, int len, bool
int read_data(usb_dev_handle* dh, int address, unsigned char *p, int len)
{
int err;
- char buf[8];
+ char buf[9];
fprintf(stderr, "[INFO] GET_CPU_INFO: ");
GET_CPU_INFO(buf);
@@ -577,6 +577,8 @@ int nand_dump(usb_dev_handle *dh)
{
fprintf(stderr,"\n[ERR] Error writing data\n");
fprintf(stderr,"[ERR] Bulk write error (%d, %s)\n", err, strerror(-err));
+ fclose(fd);
+ free(buffer);
return -1;
}
@@ -628,6 +630,8 @@ int rom_dump(usb_dev_handle *dh)
{
fprintf(stderr,"\n[ERR] Error writing data\n");
fprintf(stderr,"[ERR] Bulk write error (%d, %s)\n", err, strerror(-err));
+ fclose(fd);
+ free(buffer);
return -1;
}