Fork of SandBox's original mbed-http (https://os.mbed.com/teams/sandbox/code/mbed-http/) and update for MbedOS6+ Content of TESTS folder was replaced with basic examples form original SandBox's HelloWorld
Diff: source/http_parsed_url.h
- Revision:
- 39:a8d157986ad8
- Parent:
- 38:bfd37a21f367
--- a/source/http_parsed_url.h Fri Aug 09 13:23:47 2019 +0200 +++ b/source/http_parsed_url.h Mon Aug 12 11:45:31 2019 +0200 @@ -30,7 +30,7 @@ char* value; if (parsed_url.field_set & (1 << ix)) { value = (char*)calloc(parsed_url.field_data[ix].len + 1, 1); - memcpy((void*)value, url + parsed_url.field_data[ix].off, + memcpy(value, url + parsed_url.field_data[ix].off, parsed_url.field_data[ix].len); } else { @@ -45,7 +45,7 @@ case UF_USERINFO: _userinfo = value; break; default: // PORT is already parsed, FRAGMENT is not relevant for HTTP requests - free((void*)value); + free(value); break; } } @@ -61,17 +61,18 @@ } if (strcmp(_path, "") == 0) { + free(_path); _path = (char*)calloc(2, 1); _path[0] = '/'; } } ~ParsedUrl() { - if (_schema) free((void*)_schema); - if (_host) free((void*)_host); - if (_path) free((void*)_path); - if (_query) free((void*)_query); - if (_userinfo) free((void*)_userinfo); + if (_schema) free(_schema); + if (_host) free(_host); + if (_path) free(_path); + if (_query) free(_query); + if (_userinfo) free(_userinfo); } uint16_t port() const { return _port; }