From 612955be3c3784be2eb0c09f52289607dc4c6842 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 15 Jan 2025 21:43:57 +0100 Subject: [PATCH] fix busy device handle null --- src/kds_s2000w_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); -- 2.39.5