]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
deref pointer of value object
authorBastian Dehn <hhaalo@arcor.de>
Sun, 21 Jan 2024 16:23:12 +0000 (17:23 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 21 Jan 2024 16:23:12 +0000 (17:23 +0100)
src/kds_s2000w_handler.c

index 3ffa7254bef9b9574df621ac6ef74a20a21c9937..dfe5183fa5179c333d2cbfa5c8daec53451dbbd9 100644 (file)
@@ -92,19 +92,20 @@ device_state kds_s2000w_handler_open()
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*) &resp);
        CURLcode result = curl_easy_perform(curl);
        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &resp.code);
-
-       json_object* resObj = NULL;
+       
        if (result != CURLE_OK || resp.code == 404)
                returnState = NOTCONNECTED;
 
        if (resp.code == 423)
                returnState = BUSY;
 
+       json_object* resObj = NULL;
        if (resp.code == 200) {
                resObj = json_tokener_parse(resp.data);
                json_object* valueObj = NULL;
                json_object_object_get_ex(resObj, "SessionId", &valueObj);
                sessionid = json_object_get_int64(valueObj);
+               valueObj = NULL;
                returnState = OPENED;
        }