Merge branch 'cleanup' of https://github.com/subsurface/libdc into Subsurface-DS9

Pull coverity fixes from Dirk Hohndel.

* 'cleanup' of https://github.com/subsurface/libdc:
  fix some coverity errors
This commit is contained in:
Linus Torvalds 2020-09-21 12:21:36 -07:00
commit 1801023c68
4 changed files with 7 additions and 3 deletions

View File

@ -451,7 +451,7 @@ deepblu_download_dive(deepblu_device_t *device, unsigned char nr, dc_dive_callba
if (!callback(profile, profile_len+256, header, header_len, userdata))
return DC_STATUS_DONE;
}
free(profile);
return DC_STATUS_SUCCESS;
}

View File

@ -169,6 +169,7 @@ static int get_file_list(dc_device_t *abstract, DIR *dir, struct file_list *file
*/
entry = files->array + files->nr++;
strncpy(entry->name, de->d_name, FIT_NAME_SIZE);
entry->name[FIT_NAME_SIZE] = 0; // ensure it's null-terminated
}
DEBUG (abstract->context, "Found %d files", files->nr);
@ -334,5 +335,6 @@ garmin_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void
free(files.array);
dc_parser_destroy(parser);
dc_buffer_free(file);
return status;
}

View File

@ -50,7 +50,7 @@ garmin_parser_is_dive (dc_parser_t *abstract, const unsigned char *data, unsigne
#define FIT_NAME_SIZE 24
struct fit_name {
char name[FIT_NAME_SIZE];
char name[FIT_NAME_SIZE + 1];
};
#ifdef __cplusplus

View File

@ -210,8 +210,10 @@ static dc_status_t oceans_s1_get_blob(oceans_s1_device_t *s1, const unsigned cha
// Tell the Oceans S1 to exit block mode (??)
status = dc_iostream_write(s1->iostream, "\006", 1, NULL);
if (status != DC_STATUS_SUCCESS)
if (status != DC_STATUS_SUCCESS) {
dc_buffer_free(res);
return status;
}
size = dc_buffer_get_size(res);