From 44ef20d5aca70dd54110acbee9339f0dcdca12c0 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 7 Oct 2020 13:31:59 +0200 Subject: [PATCH] aesx660: Use convenience API to allocate USB receive buffer This also fixes a memory leak of the data as the g_free was missing and none of the callback handlers free the data either. --- libfprint/drivers/aesx660.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c index 2237c271..fb786600 100644 --- a/libfprint/drivers/aesx660.c +++ b/libfprint/drivers/aesx660.c @@ -91,13 +91,12 @@ aesX660_read_response (FpiSsm *ssm, FpiUsbTransferCallback callback) { FpiUsbTransfer *transfer = fpi_usb_transfer_new (_dev); - unsigned char *data; GCancellable *cancel = NULL; if (cancellable) cancel = fpi_device_get_cancellable (_dev); - data = g_malloc (buf_len); - fpi_usb_transfer_fill_bulk_full (transfer, EP_IN, data, buf_len, NULL); + + fpi_usb_transfer_fill_bulk (transfer, EP_IN, buf_len); transfer->ssm = ssm; transfer->short_is_error = short_is_error; fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, cancel, callback, NULL);