From defdc1ab5c365735ac85e347d463a01cf96fc72d Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Wed, 16 Jan 2013 11:57:37 +0100 Subject: [PATCH] umax: initialize reader_pid early in sane_start() This avoids that subsequent errors followed by do_cancel() attempt to phtread_cancel() an invalid thread (which may cause a crash). --- backend/umax.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/umax.c b/backend/umax.c index a9d172333..b2ceb006e 100644 --- a/backend/umax.c +++ b/backend/umax.c @@ -7285,6 +7285,10 @@ SANE_Status sane_start(SANE_Handle handle) DBG(DBG_sane_init,"sane_start\n"); + /* Initialize reader_pid to invalid so a subsequent error and following call + * to do_cancel() won't trip over it. */ + scanner->reader_pid = -1; + mode = scanner->val[OPT_MODE].s; if (scanner->device->sfd == -1) /* first call, don`t run this routine again on multi frame or multi image scan */