From: Bastian Dehn Date: Wed, 15 Jan 2025 20:43:57 +0000 (+0100) Subject: fix busy device handle null X-Git-Tag: v1.0.27^2~5 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=612955be3c3784be2eb0c09f52289607dc4c6842;p=sane-kds-s2000w-net.git fix busy device handle null --- diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index dfdd869..43d0f11 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -59,12 +59,14 @@ SANE_Status _sane_kds_s2000w_net_open(SANE_String_Const devicename, if (h->state == NOTCONNECTED) { free_handler(h); h = NULL; + *handle = NULL; return SANE_STATUS_IO_ERROR; } if (h->state == BUSY) { free_handler(h); h = NULL; + *handle = NULL; return SANE_STATUS_DEVICE_BUSY; } @@ -77,7 +79,7 @@ void _sane_kds_s2000w_net_close(SANE_Handle handle) debug_printf(ALL, "sane_kds_s2000w_net_close"); handler* h = (handler*) handle; - if (h->state != OPENED) + if (h == NULL || h->state != OPENED) return; kds_s2000w_option_descriptor_free_option_descriptors();