diff --git a/src/parse.c b/src/parse.c index 2f7b7bc..4430272 100644 --- a/src/parse.c +++ b/src/parse.c @@ -932,6 +932,7 @@ int hyper_parse_setup_routes(struct hyper_route **routes, uint32_t *r_num, char jsmn_parser p; int toks_num = 10, i, n, ret = -1; jsmntok_t *toks = NULL; + int found = 0; realloc: toks = realloc(toks, toks_num * sizeof(jsmntok_t)); @@ -961,11 +962,11 @@ realloc: fprintf(stderr, "cannot find routes\n"); goto out; } - + found = 1; break; } - if (hyper_parse_routes(routes, r_num, json, &toks[i]) < 0) { + if (found && (hyper_parse_routes(routes, r_num, json, &toks[i]) < 0)) { fprintf(stdout, "fail to parse routes\n"); goto out; }