libfprint/SOURCES/0055-vfs301-Use-a-transfer-autopointer-to-cleanup-it-on-s.patch
2021-09-09 20:12:48 +00:00

48 lines
1.7 KiB
Diff

From b82bcc0fc55035d04ac10143a909cc3a20bfcedf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Thu, 28 Nov 2019 20:40:32 +0100
Subject: [PATCH 055/181] vfs301: Use a transfer autopointer to cleanup it on
sync submission
Partially revert commit a855c0cc7, since the driver uses a sync transfer
and in such case the caller still keeps the ownership.
---
libfprint/drivers/vfs301_proto.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c
index 84e2318..2bf8bbd 100644
--- a/libfprint/drivers/vfs301_proto.c
+++ b/libfprint/drivers/vfs301_proto.c
@@ -67,7 +67,8 @@ static void
usb_recv (FpDeviceVfs301 *dev, guint8 endpoint, int max_bytes, FpiUsbTransfer **out, GError **error)
{
GError *err = NULL;
- FpiUsbTransfer *transfer;
+
+ g_autoptr(FpiUsbTransfer) transfer = NULL;
/* XXX: This function swallows any transfer errors, that is obviously
* quite bad (it used to assert on no-error)! */
@@ -78,7 +79,6 @@ usb_recv (FpDeviceVfs301 *dev, guint8 endpoint, int max_bytes, FpiUsbTransfer **
fpi_usb_transfer_submit_sync (transfer, VFS301_DEFAULT_WAIT_TIMEOUT, &err);
-
#ifdef DEBUG
usb_print_packet (0, err, transfer->buffer, transfer->actual_length);
#endif
@@ -97,7 +97,8 @@ static void
usb_send (FpDeviceVfs301 *dev, const guint8 *data, gssize length, GError **error)
{
GError *err = NULL;
- FpiUsbTransfer *transfer = NULL;
+
+ g_autoptr(FpiUsbTransfer) transfer = NULL;
/* XXX: This function swallows any transfer errors, that is obviously
* quite bad (it used to assert on no-error)! */
--
2.24.1