From 6d47c443355d0693103edfeb8f2da0038549008a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 12 Dec 2018 15:32:03 +0100
Subject: [PATCH] lib: Fix possible dereference in fpi_ssm_next_state()

libfprint/fpi-ssm.c:244:9: warning: Access to field 'completed' results in a dereference of a null pointer (loaded from variable 'machine')
        BUG_ON(machine->completed);
               ^~~~~~~~~~~~~~~~~~
libfprint/fpi-log.h:84:6: note: expanded from macro 'BUG_ON'
        if (condition) {                        \
            ^~~~~~~~~
---
 libfprint/fpi-ssm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
index 2d679b2..64430c1 100644
--- a/libfprint/fpi-ssm.c
+++ b/libfprint/fpi-ssm.c
@@ -241,6 +241,8 @@ void fpi_ssm_mark_failed(fpi_ssm *machine, int error)
  */
 void fpi_ssm_next_state(fpi_ssm *machine)
 {
+	g_return_if_fail (machine != NULL);
+
 	BUG_ON(machine->completed);
 	machine->cur_state++;
 	if (machine->cur_state == machine->nr_states) {