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

Merge mtp_device cleanup from Dirk Hohndel.

* 'crashFix' of https://github.com/subsurface/libdc:
  cleanup: ensure mtp_device field is 0
This commit is contained in:
Linus Torvalds 2021-07-19 14:37:46 -07:00
commit 2ef285faf3

View File

@ -89,7 +89,6 @@ garmin_device_open (dc_device_t **out, dc_context_t *context, dc_iostream_t *ios
ERROR (context, "Failed to allocate memory.");
return DC_STATUS_NOMEMORY;
}
// Set the default values.
device->iostream = iostream;
memset(device->fingerprint, 0, sizeof(device->fingerprint));
@ -99,6 +98,7 @@ garmin_device_open (dc_device_t **out, dc_context_t *context, dc_iostream_t *ios
// for Garmin devices, the model number corresponds to the lower three nibbles of the USB product ID
// in order to have only one entry for the Mk2, we don't use the Mk2/APAC model number in our code
device->use_mtp = (model == (0x0FFF & DESCENT_MK2));
device->mtp_device = NULL;
DEBUG(context, "Found Garmin with model 0x%x which is a %s\n", model, (device->use_mtp ? "Mk2/Mk2i" : "Mk1"));
#endif