]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
fix free response
authorBastian Dehn <hhaalo@arcor.de>
Mon, 29 Jan 2024 15:40:23 +0000 (16:40 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 29 Jan 2024 15:40:23 +0000 (16:40 +0100)
src/kds_s2000w_handler.c

index a3e0bab89881341f4c6d41549ca05d2cfdedb03e..4115a784b65c9ca564c6109821668947d19b4d7a 100644 (file)
@@ -23,7 +23,7 @@ void _write_string_value(json_object* value_object, void* value)
 void _write_int_value(json_object* value_object, void* value)
 {
        int* int_value_ptr = (int*) value;
-       *int_value_ptr = json_object_get_int(value_object);;
+       *int_value_ptr = json_object_get_int(value_object);
 }
 
 void _write_string_value_to_json(json_object* value_object, void* value)
@@ -317,14 +317,14 @@ void kds_s2000w_handler_set_option(int option, void* value, int* info)
                case 24:
                        resp = kds_s2000w_client_response_init();
                        kds_s2000w_client_get_capabilities(resp);
-
                        json_object* capabilities = json_tokener_parse(resp->data);
                        json_object* default_values = json_object_object_get(capabilities, "Defaults");
                        json_object* default_config = json_object_new_object();
                        json_object_object_add(default_config, "Configuration", default_values);
                        const char* json_string = json_object_to_json_string_ext(default_config, JSON_C_TO_STRING_PLAIN);
-                       
                        kds_s2000w_client_response_free(resp);
+                       resp = NULL;
+
                        resp = kds_s2000w_client_response_init();
                        resp->size = sizeof(char) * strlen(json_string);
                        resp->code = 0;
@@ -332,10 +332,10 @@ void kds_s2000w_handler_set_option(int option, void* value, int* info)
                        resp->data = memcpy(resp->data, json_string, resp->size);
                        kds_s2000w_client_set_option(state->sessionid, resp);
                        kds_s2000w_client_response_free(resp);
-
                        resp = NULL;
                        json_object_put(capabilities);
                        capabilities = NULL;
+
                        *info = RELOAD_OPTIONS;
                        _load_options();
                        return;