]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
fix out of mem alloc in handler
authorBastian Dehn <hhaalo@arcor.de>
Wed, 15 Oct 2025 08:08:14 +0000 (10:08 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 15 Oct 2025 08:08:14 +0000 (10:08 +0200)
src/kds_s2000w_handler.c

index 3a610ae247956a07964e88f14844522d2ee93c80..173d7c6f764ae30796d301d80bfd65b0ec7cbf94 100644 (file)
@@ -40,6 +40,8 @@ uint32_t _kds_s2000w_handler_find_first_data_byte(const imagedata* image)
 client_config_t* _kds_s2000w_handler_convert_config(program_config* config)
 {
        client_config_t* client_config = malloc(sizeof(client_config_t));
+       if (client_config == NULL)
+               return NULL;
 
        client_config->scanner_url = config->scanner_url;
        client_config->username = config->username;
@@ -62,6 +64,9 @@ void _kds_s2000w_handler_load_config(handler* h)
                return;
 
        client_config_t* client_config = _kds_s2000w_handler_convert_config(config);
+       if (client_config == NULL)
+               return;
+
        kds_s2000w_client_init(client_config);
        kds_s2000w_debug_set_default_log_level(config->log_level);
        h->profile = config->profile;