From 96fa0a96eb2f5f25027a27390673d715c9182fff Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Mon, 19 Oct 2020 17:01:06 +0200 Subject: [PATCH] uru4000: Fix missing reference to image transfer We might redo image transfers, but we only ever had one reference that was implicitly removed after the transfer completed. Add a new reference each time it is submitted and only free the last reference in the stop handler. --- libfprint/drivers/uru4000.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c index 63f99a3..2ba4d39 100644 --- a/libfprint/drivers/uru4000.c +++ b/libfprint/drivers/uru4000.c @@ -663,7 +663,11 @@ imaging_run_state (FpiSsm *ssm, FpDevice *_dev) case IMAGING_CAPTURE: self->img_lines_done = 0; self->img_block = 0; - fpi_usb_transfer_submit (self->img_transfer, 0, NULL, image_transfer_cb, NULL); + fpi_usb_transfer_submit (fpi_usb_transfer_ref (self->img_transfer), + 0, + NULL, + image_transfer_cb, + NULL); break; @@ -799,8 +803,7 @@ imaging_complete (FpiSsm *ssm, FpDevice *dev, GError *error) if (error) fpi_image_device_session_error (FP_IMAGE_DEVICE (dev), error); - /* Freed by callback or cancellation */ - self->img_transfer = NULL; + g_clear_pointer (&self->img_transfer, fpi_usb_transfer_unref); g_free (self->img_data); self->img_data = NULL;