]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change refactor free option descriptor
authorBastian Dehn <hhaalo@arcor.de>
Mon, 22 Sep 2025 12:12:46 +0000 (14:12 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 22 Sep 2025 12:12:46 +0000 (14:12 +0200)
src/kds_s2000w_option_descriptors.c

index e733df08ef8f071e7a89b504d0ffeb28735740a6..1aa117bd1984846e15be7bbd22e445ba467aea3b 100644 (file)
@@ -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]);