summaryrefslogtreecommitdiff
path: root/gpsflash.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-10-27 01:45:12 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-10-27 01:45:12 +0000
commit89f3340f6ca33f4d3800100f24303dd4b7e130b3 (patch)
treefe5e5a04d3e96b046f61e09100ca4bfac2ba9f9f /gpsflash.c
parentd20ff54cbc1dd6201c6245c814f13d16e6dbbad0 (diff)
downloadgpsd-89f3340f6ca33f4d3800100f24303dd4b7e130b3.tar.gz
splint cleanup of gpsflash code.
Diffstat (limited to 'gpsflash.c')
-rw-r--r--gpsflash.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gpsflash.c b/gpsflash.c
index d5ce25ff..7345e4b4 100644
--- a/gpsflash.c
+++ b/gpsflash.c
@@ -16,6 +16,8 @@
static char *progname;
static int verbosity = 0;
+static bool srec_check(const char *data);
+
void gpsd_report(int errlevel, const char *fmt, ... )
/* assemble command in printf(3) style, use stderr or syslog */
{
@@ -519,6 +521,8 @@ main(int argc, char **argv){
*/
gpsd_report(1, "validating firmware\n");
if (srec_check(firmware)){
+ (void)free(loader);
+ (void)free(firmware);
gpsd_report(0, "%s: corrupted firmware image\n", fname);
return 1;
}
@@ -610,9 +614,9 @@ main(int argc, char **argv){
return 0;
}
-bool
-srec_check(char *data){
- unsigned int i, l, n, x, y, z;
+static bool
+srec_check(const char *data){
+ int i, l, n, x, y, z;
char buf[85];
l = 0;
@@ -625,7 +629,7 @@ srec_check(char *data){
return true;
}
- n = strlen(buf);
+ n = (int)strlen(buf);
if ((n < 1) || (n > 80)){
gpsd_report(0, "firmware line %d invalid length %d\n", l, n);
return true;