From ba7a45d3f8ca52fa63636ce00e89252eb23fe33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 4 Feb 2020 19:47:56 +0100 Subject: [PATCH] device: Always free error in delete enrolled fingers2 During delete enrolled fingers2 call, if the check-claimed control fails, 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 the other manual free call, and use an auto-pointer instead for this function. --- src/device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index e7c0eeb..bdb5304 100644 --- a/src/device.c +++ b/src/device.c @@ -1407,7 +1407,7 @@ static void fprint_device_delete_enrolled_fingers2(FprintDevice *rdev, DBusGMethodInvocation *context) { FprintDevicePrivate *priv = fprint_device_get_instance_private(rdev); - GError *error = NULL; + g_autoptr(GError) error = NULL; if (_fprint_device_check_claimed(rdev, context, &error) == FALSE) { dbus_g_method_return_error (context, error); @@ -1416,7 +1416,6 @@ static void fprint_device_delete_enrolled_fingers2(FprintDevice *rdev, if (_fprint_device_check_polkit_for_action (rdev, context, "net.reactivated.fprint.device.enroll", &error) == FALSE) { dbus_g_method_return_error (context, error); - g_error_free (error); return; }