egis_etu905: Do not leak the transfer buffer

The buffer is now owned by the data, so we should not steal it when
passing it around or we'll leak.
This commit is contained in:
Marco Trevisan (Treviño)
2026-06-09 14:19:17 +02:00
parent 9bddd90f06
commit c216f04dd1
+4 -2
View File
@@ -207,7 +207,8 @@ egis_etu905_cmd_receive_cb (FpiUsbTransfer *transfer,
fpi_ssm_mark_failed (transfer->ssm, error); fpi_ssm_mark_failed (transfer->ssm, error);
return; return;
} }
if (data == NULL || transfer->actual_length < egis_etu905_read_prefix_len)
if (transfer->actual_length < egis_etu905_read_prefix_len)
{ {
fpi_ssm_mark_failed (transfer->ssm, fpi_ssm_mark_failed (transfer->ssm,
fpi_device_error_new (FP_DEVICE_ERROR_GENERAL)); fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
@@ -216,6 +217,7 @@ egis_etu905_cmd_receive_cb (FpiUsbTransfer *transfer,
/* Store the response data and let the cmd_ssm_done callback invoke /* Store the response data and let the cmd_ssm_done callback invoke
* the actual callback with the stored data */ * the actual callback with the stored data */
g_assert (data != NULL);
data->buffer_in = g_steal_pointer (&transfer->buffer); data->buffer_in = g_steal_pointer (&transfer->buffer);
data->length_in = transfer->actual_length; data->length_in = transfer->actual_length;
@@ -282,7 +284,7 @@ egis_etu905_cmd_ssm_done (FpiSsm *ssm,
if (data && data->callback) if (data && data->callback)
{ {
data->callback (device, data->callback (device,
g_steal_pointer (&data->buffer_in), data->buffer_in,
data->length_in, data->length_in,
g_steal_pointer (&local_error)); g_steal_pointer (&local_error));
} }