From 49dced5566ca48d934c97f7fc40790dfc5b080c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 29 Jan 2020 22:14:36 +0100 Subject: [PATCH] device: Always free error in delete enrolled fingers During delete enrolled fingers call, if the check-claimed control fails, and we get an error different from FPRINT_ERROR_CLAIM_DEVICE, we would return the error without freeing it. While this could be fixed by just a further g_error_free call, let's just remove all the manual free calls, and use an auto-pointer instead for this function. --- src/device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/device.c b/src/device.c index e4f7b1d..e7c0eeb 100644 --- a/src/device.c +++ b/src/device.c @@ -1349,7 +1349,7 @@ static void fprint_device_delete_enrolled_fingers(FprintDevice *rdev, DBusGMethodInvocation *context) { FprintDevicePrivate *priv = fprint_device_get_instance_private(rdev); - GError *error = NULL; + g_autoptr(GError) error = NULL; char *user, *sender; gboolean opened; @@ -1365,14 +1365,12 @@ static void fprint_device_delete_enrolled_fingers(FprintDevice *rdev, &error); if (user == NULL) { dbus_g_method_return_error (context, error); - g_error_free (error); return; } if (_fprint_device_check_polkit_for_action (rdev, context, "net.reactivated.fprint.device.enroll", &error) == FALSE) { g_free (user); dbus_g_method_return_error (context, error); - g_error_free (error); return; } @@ -1383,7 +1381,6 @@ static void fprint_device_delete_enrolled_fingers(FprintDevice *rdev, return; } - g_clear_error (&error); opened = FALSE; } else { opened = TRUE;