diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-12-28 22:01:16 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-29 09:14:20 -0800 |
commit | dc714e582f591d26ef08004fbe904b4868462d73 (patch) | |
tree | cf5380d0371eff4a30fdfdc60ba6809696d80de7 /core | |
parent | ca7b0017a7b455652dc0b69d0f1203530bc03f62 (diff) | |
download | subsurface-dc714e582f591d26ef08004fbe904b4868462d73.tar.gz |
cleanup: Unchecked return value from library
CID 60227
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core')
-rw-r--r-- | core/ostctools.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/core/ostctools.c b/core/ostctools.c index e56b50f5d..53dab4aaa 100644 --- a/core/ostctools.c +++ b/core/ostctools.c @@ -57,7 +57,12 @@ void ostctools_import(const char *file, struct dive_table *divetable) // Read dive number from the log uc_tmp = calloc(2, 1); - fseek(archive, 258, 0); + if (fseek(archive, 258, 0) == -1) { + report_error(failed_to_read_msg, file); + free(uc_tmp); + free(ostcdive); + goto close_out; + } if (fread(uc_tmp, 1, 2, archive) != 2) { report_error(failed_to_read_msg, file); free(uc_tmp); @@ -69,7 +74,12 @@ void ostctools_import(const char *file, struct dive_table *divetable) // Read device's serial number uc_tmp = calloc(2, 1); - fseek(archive, 265, 0); + if (fseek(archive, 265, 0) == -1) { + report_error(failed_to_read_msg, file); + free(uc_tmp); + free(ostcdive); + goto close_out; + } if (fread(uc_tmp, 1, 2, archive) != 2) { report_error(failed_to_read_msg, file); free(uc_tmp); @@ -80,7 +90,12 @@ void ostctools_import(const char *file, struct dive_table *divetable) free(uc_tmp); // Read dive's raw data, header + profile - fseek(archive, 456, 0); + if (fseek(archive, 456, 0) == -1) { + report_error(failed_to_read_msg, file); + free(uc_tmp); + free(ostcdive); + goto close_out; + } while ((c = getc(archive)) != EOF) { buffer[i] = c; if (buffer[i] == 0xFD && buffer[i - 1] == 0xFD) |