Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang static analyser fixes #1154

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/nxt_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,14 +1077,14 @@ nxt_router_temp_conf(nxt_task_t *task)

rtcf = nxt_mp_zget(mp, sizeof(nxt_router_conf_t));
if (nxt_slow_path(rtcf == NULL)) {
goto fail;
goto out_free_mp;
}

rtcf->mem_pool = mp;

rtcf->tstr_state = nxt_tstr_state_new(mp, 0);
if (nxt_slow_path(rtcf->tstr_state == NULL)) {
goto fail;
goto out_free_mp;
}

#if (NXT_HAVE_NJS)
Expand All @@ -1093,12 +1093,12 @@ nxt_router_temp_conf(nxt_task_t *task)

tmp = nxt_mp_create(1024, 128, 256, 32);
if (nxt_slow_path(tmp == NULL)) {
goto fail;
goto out_free_tstr_state;
}

tmcf = nxt_mp_zget(tmp, sizeof(nxt_router_temp_conf_t));
if (nxt_slow_path(tmcf == NULL)) {
goto temp_fail;
goto out_free;
}

tmcf->mem_pool = tmp;
Expand All @@ -1109,7 +1109,7 @@ nxt_router_temp_conf(nxt_task_t *task)
tmcf->engines = nxt_array_create(tmcf->mem_pool, 4,
sizeof(nxt_router_engine_conf_t));
if (nxt_slow_path(tmcf->engines == NULL)) {
goto temp_fail;
goto out_free;
}

nxt_queue_init(&creating_sockets);
Expand All @@ -1131,16 +1131,18 @@ nxt_router_temp_conf(nxt_task_t *task)

return tmcf;

temp_fail:
out_free:

nxt_mp_destroy(tmp);

fail:
out_free_tstr_state:

if (rtcf->tstr_state != NULL) {
nxt_tstr_state_release(rtcf->tstr_state);
}

out_free_mp:

nxt_mp_destroy(mp);

return NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/nxt_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ nxt_var_interpreter(nxt_task_t *task, nxt_tstr_state_t *state,
}

if (last != var->length) {
p = nxt_cpymem(p, &src[last], var->length - last);
nxt_cpymem(p, &src[last], var->length - last);
}

return NXT_OK;
Expand Down