libflashprog: Run programmer_shutdown() on failed setup

The programmer init functions can already register shutdown functions
that we missed to call should the initialization fail. The callers of
flashprog_programmer_init() can't take care of it, because they never
receive a valid handle in this case.

Change-Id: I03111d8096fac908f8808480a4df513fca8d84f5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/243
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/libflashprog.c b/libflashprog.c
index 5256657..948fbde 100644
--- a/libflashprog.c
+++ b/libflashprog.c
@@ -167,6 +167,7 @@
 	return 0;
 
 _free_err:
+	programmer_shutdown(*flashprog);
 	free((*flashprog)->param);
 	free(*flashprog);
 	return 1;