]> git.kaiwu.me - nginx.git/commitdiff
SPDY: moved a variable initialization near to its check.
authorValentin Bartenev <vbart@nginx.com>
Wed, 9 Apr 2014 14:15:32 +0000 (18:15 +0400)
committerValentin Bartenev <vbart@nginx.com>
Wed, 9 Apr 2014 14:15:32 +0000 (18:15 +0400)
This should prevent attempts of using pointer before it was checked, since
all modern compilers are able to spot access to uninitialized variable.

No functional changes.

src/http/ngx_http_spdy.c

index 4f3ea1edca79ed2940c1649dc364fc7bfd7390d6..b935b6fdda2a8b23908f13780fd99b3aa34f9ec3 100644 (file)
@@ -1412,8 +1412,6 @@ ngx_http_spdy_state_data(ngx_http_spdy_connection_t *sc, u_char *pos,
 {
     ngx_http_spdy_stream_t  *stream;
 
-    stream = sc->stream;
-
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
                    "spdy DATA frame");
 
@@ -1441,6 +1439,8 @@ ngx_http_spdy_state_data(ngx_http_spdy_connection_t *sc, u_char *pos,
         sc->recv_window = NGX_SPDY_MAX_WINDOW;
     }
 
+    stream = sc->stream;
+
     if (stream == NULL) {
         return ngx_http_spdy_state_skip(sc, pos, end);
     }