diff options
author | hongzhidao <hongzhidao@gmail.com> | 2020-08-28 00:53:36 -0400 |
---|---|---|
committer | hongzhidao <hongzhidao@gmail.com> | 2020-08-28 00:53:36 -0400 |
commit | 806135f1c93c09bb513efc1341d084951b080278 (patch) | |
tree | fad5c6e1fbdcc4be78fb289546ebcfdfbb0aec32 /src/nxt_upstream.c | |
parent | d5e915934066c77a59d211efafca10c117b73d05 (diff) | |
download | unit-806135f1c93c09bb513efc1341d084951b080278.tar.gz unit-806135f1c93c09bb513efc1341d084951b080278.tar.bz2 |
Router: fixed "pass" to upstreams.
Messed up return values in nxt_upstream_find() caused error in applying any
configuration with a valid "pass" value in router configuration pointing to
upstream. That wasn't the case in "listeners" objects, where the return value
wasn't checked.
Also, it caused segfault in cases where the "pass" option was configured with
variables and resulting value was pointing to a non-existent upstream.
Added missing return checks as well to catch possible memory allocation errors.
The bug was introduced in d32bc428f46b.
This closes #472 issue on GitHub.
Diffstat (limited to 'src/nxt_upstream.c')
-rw-r--r-- | src/nxt_upstream.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nxt_upstream.c b/src/nxt_upstream.c index c8ecbbe6..9f81b286 100644 --- a/src/nxt_upstream.c +++ b/src/nxt_upstream.c @@ -86,11 +86,11 @@ nxt_upstream_find(nxt_upstreams_t *upstreams, nxt_str_t *name, action->u.upstream_number = i; action->handler = nxt_upstream_handler; - return NXT_DECLINED; + return NXT_OK; } } - return NXT_OK; + return NXT_DECLINED; } |