]> git.kaiwu.me - nginx.git/commitdiff
Upstream: restored workaround for "if".
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 30 Apr 2014 15:16:55 +0000 (19:16 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 30 Apr 2014 15:16:55 +0000 (19:16 +0400)
The 7022564a9e0e changeset made ineffective workaround from 2464ccebdb52
to avoid NULL pointer dereference with "if".  It is now restored by
moving the u->ssl_name initialization after the check.

Found by Coverity (CID 1210408).

src/http/ngx_http_upstream.c

index a64538309f0ccea7936ff12445c1ea0ca615cdaa..de3ff130a95199f50b0afaac29f6374ced880c99 100644 (file)
@@ -584,9 +584,6 @@ ngx_http_upstream_init_request(ngx_http_request_t *r)
     if (u->resolved == NULL) {
 
         uscf = u->conf->upstream;
-#if (NGX_HTTP_SSL)
-        u->ssl_name = uscf->host;
-#endif
 
     } else {
 
@@ -680,6 +677,10 @@ found:
         return;
     }
 
+#if (NGX_HTTP_SSL)
+    u->ssl_name = uscf->host;
+#endif
+
     if (uscf->peer.init(r, uscf) != NGX_OK) {
         ngx_http_upstream_finalize_request(r, u,
                                            NGX_HTTP_INTERNAL_SERVER_ERROR);