Index: epson2.c =================================================================== RCS file: /cvsroot/sane/sane-backends/backend/epson2.c,v retrieving revision 1.15 retrieving revision 1.17 diff -u -r1.15 -r1.17 --- backend/epson2.c 3 Feb 2008 12:09:09 -0000 1.15 +++ backend/epson2.c 3 May 2008 14:43:07 -0000 1.17 @@ -1243,6 +1243,7 @@ * set dummy values. */ + s->fd = -1; s->hw = dev; dev->name = NULL; @@ -1323,7 +1324,6 @@ if (status != SANE_STATUS_GOOD) { DBG(1, "%s: inquiry failed: %s\n", __func__, sane_strstatus(status)); - close_scanner(s); goto free; } @@ -1534,8 +1534,6 @@ dev->need_reset_on_source_change = SANE_TRUE; } - close_scanner(s); - /* we are done with this one, prepare for the next scanner */ num_devices++; dev->next = first_dev; @@ -1545,6 +1543,7 @@ *devp = dev; free: + close_scanner(s); free(s); return status; }