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) {                        \
            ^~~~~~~~~
This commit is contained in:
Bastien Nocera
2018-12-12 15:32:03 +01:00
parent 3cbc908a6e
commit 6d47c44335

View File

@@ -241,6 +241,8 @@ void fpi_ssm_mark_failed(fpi_ssm *machine, int error)
*/ */
void fpi_ssm_next_state(fpi_ssm *machine) void fpi_ssm_next_state(fpi_ssm *machine)
{ {
g_return_if_fail (machine != NULL);
BUG_ON(machine->completed); BUG_ON(machine->completed);
machine->cur_state++; machine->cur_state++;
if (machine->cur_state == machine->nr_states) { if (machine->cur_state == machine->nr_states) {