sys/uri_parser: initialize has_authority in _consume_scheme()

This commit is contained in:
Cenk Gündoğan 2020-04-01 11:10:09 +02:00
parent 5e429d5697
commit abc1cb17ca

View File

@ -38,7 +38,9 @@ static char *_consume_scheme(uri_parser_result_t *result, char *uri,
char *uri_end, bool *has_authority) char *uri_end, bool *has_authority)
{ {
assert(uri); assert(uri);
assert(!has_authority);
/* assume no authority section first */
*has_authority = false;
/* cannot have empty scheme */ /* cannot have empty scheme */
if (uri[0] == ':') { if (uri[0] == ':') {
@ -186,7 +188,7 @@ static int _parse_relative(uri_parser_result_t *result, char *uri,
static int _parse_absolute(uri_parser_result_t *result, char *uri, static int _parse_absolute(uri_parser_result_t *result, char *uri,
char *uri_end) char *uri_end)
{ {
bool has_authority = false; bool has_authority;
uri = _consume_scheme(result, uri, uri_end, &has_authority); uri = _consume_scheme(result, uri, uri_end, &has_authority);
if (uri == NULL) { if (uri == NULL) {