diff --git a/src/shearwater_common.c b/src/shearwater_common.c index 0a73891..fef8460 100644 --- a/src/shearwater_common.c +++ b/src/shearwater_common.c @@ -338,7 +338,7 @@ shearwater_common_download (shearwater_common_device_t *device, dc_buffer_t *buf unsigned char response[SZ_PACKET]; // Erase the current contents of the buffer. - if (!dc_buffer_clear (buffer) || !dc_buffer_reserve (buffer, size)) { + if (!dc_buffer_clear (buffer)) { ERROR (abstract->context, "Insufficient buffer space available."); return DC_STATUS_NOMEMORY; } diff --git a/src/shearwater_predator.c b/src/shearwater_predator.c index 81895e4..f0b1e99 100644 --- a/src/shearwater_predator.c +++ b/src/shearwater_predator.c @@ -134,6 +134,12 @@ shearwater_predator_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) { shearwater_common_device_t *device = (shearwater_common_device_t *) abstract; + // Erase the current contents of the buffer. + if (!dc_buffer_clear (buffer) || !dc_buffer_reserve (buffer, SZ_MEMORY)) { + ERROR (abstract->context, "Insufficient buffer space available."); + return DC_STATUS_NOMEMORY; + } + return shearwater_common_download (device, buffer, 0xDD000000, SZ_MEMORY, 0); }