From: Bastian Dehn Date: Sat, 11 Oct 2025 08:38:01 +0000 (+0200) Subject: fix null pointer auto of memory kds net X-Git-Tag: v1.1.10^2~16 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=8d5a0dcaf45c5a2d70ab08e7a63dc1c8d26d843b;p=sane-kds-s2000w-net.git fix null pointer auto of memory kds net --- diff --git a/src/kds_s2000w_net.c b/src/kds_s2000w_net.c index eb2225c..6a184d9 100644 --- a/src/kds_s2000w_net.c +++ b/src/kds_s2000w_net.c @@ -43,10 +43,16 @@ SANE_Status sane_kds_s2000w_net_get_devices(SANE_Device*** device_list, if (local_only) return SANE_STATUS_NO_MEM; - if (device_info_ptr == NULL) { - device_info_ptr = malloc(sizeof(SANE_Device*) * 2); - device_info_ptr[0] = malloc(sizeof(SANE_Device)); - } + if (device_info_ptr != NULL) + return SANE_STATUS_GOOD; + + device_info_ptr = malloc(sizeof(SANE_Device*) * 2); + if (device_info_ptr == NULL) + return SANE_STATUS_NO_MEM; + + device_info_ptr[0] = malloc(sizeof(SANE_Device)); + if (device_info_ptr[0] == NULL) + return SANE_STATUS_NO_MEM; device_info_ptr[0]->name = NAME; device_info_ptr[0]->vendor = VENDOR;