NJS: adding the missing vm destruction.

This commit fixed the njs memory leak happened in the config validation, updating and http requests.
This commit is contained in:
Zhidao HONG
2023-01-30 11:16:01 +08:00
parent cbc01907fe
commit 789762ff3d
8 changed files with 69 additions and 4 deletions

View File

@@ -1284,25 +1284,35 @@ nxt_conf_validate(nxt_conf_validation_t *vldt)
vldt->tstr_state = nxt_tstr_state_new(vldt->pool, 1);
if (nxt_slow_path(vldt->tstr_state == NULL)) {
return NXT_ERROR;
ret = NXT_ERROR;
goto fail;
}
ret = nxt_conf_vldt_type(vldt, NULL, vldt->conf, NXT_CONF_VLDT_OBJECT);
if (ret != NXT_OK) {
return ret;
goto fail;
}
ret = nxt_conf_vldt_object(vldt, vldt->conf, nxt_conf_vldt_root_members);
if (ret != NXT_OK) {
return ret;
goto fail;
}
ret = nxt_tstr_state_done(vldt->tstr_state, error);
if (ret != NXT_OK) {
return nxt_conf_vldt_error(vldt, "%s", error);
ret = nxt_conf_vldt_error(vldt, "%s", error);
goto fail;
}
nxt_tstr_state_release(vldt->tstr_state);
return NXT_OK;
fail:
nxt_tstr_state_release(vldt->tstr_state);
return ret;
}