From 7a72d8fd5875153c0c486edc119902b3e34438f6 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 23 Oct 2018 12:47:05 +0200 Subject: [PATCH] lib: Fix uninitialised variable in fpi_imgdev_image_captured() libfprint/fpi-dev-img.c:255:6: warning: variable 'print' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (imgdev->action != IMG_ACTION_CAPTURE) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libfprint/fpi-dev-img.c:271:25: note: uninitialized use occurs here imgdev->acquire_data = print; ^~~~~ libfprint/fpi-dev-img.c:255:2: note: remove the 'if' if its condition is always true if (imgdev->action != IMG_ACTION_CAPTURE) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libfprint/fpi-dev-img.c:232:29: note: initialize the variable 'print' to silence this warning struct fp_print_data *print; ^ = NULL --- libfprint/fpi-dev-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfprint/fpi-dev-img.c b/libfprint/fpi-dev-img.c index bdf4fec..b094da2 100644 --- a/libfprint/fpi-dev-img.c +++ b/libfprint/fpi-dev-img.c @@ -238,7 +238,7 @@ void fpi_imgdev_abort_scan(struct fp_img_dev *imgdev, int result) void fpi_imgdev_image_captured(struct fp_img_dev *imgdev, struct fp_img *img) { - struct fp_print_data *print; + struct fp_print_data *print = NULL; int r; G_DEBUG_HERE();