[sane-devel] [patch] Fix up error checking in canon backend

Tim Waugh twaugh@redhat.com
Thu, 9 Jan 2003 12:17:25 +0000


Hi,

Here is a patch to fix a crash in the canon backend.  More details at:
<https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=81332>.

Tim.
*/

--- sane-backends-1.0.9/backend/canon-sane.c.errorchk	2003-01-09 11:52:50.000000000 +0000
+++ sane-backends-1.0.9/backend/canon-sane.c	2003-01-09 11:54:30.000000000 +0000
@@ -1242,7 +1242,9 @@
   if ((s->hw->info.model != FB620) &&	/* modification for FB620S */
       (s->val[OPT_PREVIEW].w == SANE_FALSE) && (s->AF_NOW == SANE_TRUE))
     {
-      do_focus (s);
+      status = do_focus (s);
+      if (status != SANE_STATUS_GOOD)
+	return status;
       if (s->val[OPT_AF_ONCE].w == SANE_TRUE)
 	{
 	  s->AF_NOW = SANE_FALSE;
@@ -1251,7 +1253,9 @@
 
   if (s->val[OPT_CUSTOM_GAMMA].w == 1)
     {
-      do_gamma (s);
+      status = do_gamma (s);
+      if (status != SANE_STATUS_GOOD)
+	return status;
     }
 
 #if 1