-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hi Tuan,
I am using ESP32 dev kit. I am thinking to use esp-request https client library in one of my project for OTA feature.
I found this library very simplistic and useful for me. So before using it for production use, I just tried
executing cppcheck static analyser tool. cppcheck detects memory leak, and also give nice suggestion to reduce scope of the many variables.
Is it possible to optimise esp_request library considering low power mode usability ?
Any points/suggestions welcome.
cppcheck LOG:
$ cppcheck --enable=all esp-request
Checking esp-request/esp_request.c...
[esp-request/esp_request.c:135]: (style) The scope of the variable 'maskKey' can be reduced.
[esp-request/esp_request.c:293]: (style) The scope of the variable 'random_key' can be reduced.
[esp-request/esp_request.c:293]: (style) The scope of the variable 'b64_key' can be reduced.
[esp-request/esp_request.c:500]: (style) The scope of the variable 'bread' can be reduced.
[esp-request/esp_request.c:502]: (style) The scope of the variable 'buffer_free_bytes' can be reduced.
[esp-request/esp_request.c:300]: (error) Memory leak: req
[esp-request/esp_request.c:305]: (error) Memory leak: req
[esp-request/esp_request.c:313]: (error) Memory leak: req
[esp-request/esp_request.c:317]: (error) Memory leak: req
[esp-request/esp_request.c:353]: (error) Memory leak: host_w_port
1/3 files checked 33% done
Checking esp-request/req_list.c...
2/3 files checked 66% done
Checking esp-request/uri_parser.c...
[esp-request/uri_parser.c:51] -> [esp-request/uri_parser.c:52]: (warning) Either the condition '0==puri' is redundant or there is possible null pointer dereference: puri.
3/3 files checked 100% done
[esp-request/uri_parser.c:192]: (style) The function 'parse_uri_info' is never used.
[esp-request/esp_request.c:711]: (style) The function 'req_clean' is never used.
[esp-request/esp_request.c:703]: (style) The function 'req_close' is never used.
[esp-request/req_list.c:178]: (style) The function 'req_list_clear_key' is never used.
[esp-request/req_list.c:163]: (style) The function 'req_list_set_format' is never used.
[esp-request/esp_request.c:291]: (style) The function 'req_new' is never used.
[esp-request/esp_request.c:673]: (style) The function 'req_perform' is never used.
[esp-request/esp_request.c:707]: (style) The function 'req_write' is never used.
(information) Cppcheck cannot find all the include files (use --check-config for details)
$