From: Bastian Dehn Date: Mon, 22 Sep 2025 12:12:46 +0000 (+0200) Subject: change refactor free option descriptor X-Git-Tag: v1.1.5^2~4 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=b134e7cdf0d37bf58c244dceb67209dea0a67489;p=sane-kds-s2000w-net.git change refactor free option descriptor --- diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index e733df0..1aa117b 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -1218,24 +1218,20 @@ void kds_s2000w_option_descriptors_free() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_free_option_descriptors"); - SANE_Option_Descriptor* descriptor = NULL; - for (int i = 0; i < MAX_OPTION_COUNT; i++) { - descriptor = kds_s2000w_option_descriptors_get_by_number(i); - - if (descriptor->constraint_type == SANE_CONSTRAINT_STRING_LIST) { - free((void*) descriptor->constraint.string_list); - descriptor->constraint.string_list = NULL; + if (descriptors[i]->descriptor.constraint_type == SANE_CONSTRAINT_STRING_LIST) { + free((void*) descriptors[i]->descriptor.constraint.string_list); + descriptors[i]->descriptor.constraint.string_list = NULL; } - if (descriptor->constraint_type == SANE_CONSTRAINT_WORD_LIST) { - free((void*) descriptor->constraint.word_list); - descriptor->constraint.word_list = NULL; + if (descriptors[i]->descriptor.constraint_type == SANE_CONSTRAINT_WORD_LIST) { + free((void*) descriptors[i]->descriptor.constraint.word_list); + descriptors[i]->descriptor.constraint.word_list = NULL; } - if (descriptor->constraint_type == SANE_CONSTRAINT_RANGE) { - free((void*) descriptor->constraint.range); - descriptor->constraint.range = NULL; + if (descriptors[i]->descriptor.constraint_type == SANE_CONSTRAINT_RANGE) { + free((void*) descriptors[i]->descriptor.constraint.range); + descriptors[i]->descriptor.constraint.range = NULL; } free(descriptors[i]);