From 43cf28b9dafae9c220232ae3000755663a31fbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 28 Jan 2021 02:27:40 +0100 Subject: [PATCH] fp-device: Do not try to deference potentially NULL task data In case we do an early error return in verify and identify calls we do not initialize the task data, but still in the finish functions we still try to use it. Avoid doing this, but just nullify the returned values. --- libfprint/fp-device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c index a5973e8..fedaa33 100644 --- a/libfprint/fp-device.c +++ b/libfprint/fp-device.c @@ -979,7 +979,7 @@ fp_device_verify_finish (FpDevice *device, data = g_task_get_task_data (G_TASK (result)); - *print = data->print; + *print = data ? data->print : NULL; if (*print) g_object_ref (*print); } @@ -1092,13 +1092,13 @@ fp_device_identify_finish (FpDevice *device, if (print) { - *print = data->print; + *print = data ? data->print : NULL; if (*print) g_object_ref (*print); } if (match) { - *match = data->match; + *match = data ? data->match : NULL; if (*match) g_object_ref (*match); }