Fix a segfault if a scan was shorter than 8 lines.

This segfault was caused by proceeding to free the conversion result
without checking for an error condition in image to print
data conversion.

http://lists.reactivated.net/pipermail/fprint/2009-December/001405.html
This commit is contained in:
Alexia Death 2009-12-26 01:00:59 +02:00 committed by Bastien Nocera
parent daee067c4f
commit 4b518bd230

View file

@ -228,8 +228,12 @@ void fpi_imgdev_image_captured(struct fp_img_dev *imgdev, struct fp_img *img)
fp_img_standardize(img);
imgdev->acquire_img = img;
fpi_img_to_print_data(imgdev, img, &print);
if (img->minutiae->num < MIN_ACCEPTABLE_MINUTIAE) {
r = fpi_img_to_print_data(imgdev, img, &print);
if (r < 0) {
fp_dbg("image to print data conversion error: %d", r);
imgdev->action_result = FP_ENROLL_RETRY;
goto next_state;
} else if (img->minutiae->num < MIN_ACCEPTABLE_MINUTIAE) {
fp_dbg("not enough minutiae, %d/%d", img->minutiae->num,
MIN_ACCEPTABLE_MINUTIAE);
fp_print_data_free(print);