]> granicus.if.org Git - curl/commitdiff
http2: avoid set_stream_user_data() before stream is assigned
authorDaniel Stenberg <daniel@haxx.se>
Mon, 20 Aug 2018 11:19:08 +0000 (13:19 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 21 Aug 2018 06:04:38 +0000 (08:04 +0200)
... before the stream is started, we have it set to -1.

Fixes #2894
Closes #2898

lib/http2.c

index 9380ca7cf6721ccc71dc167fb4593c6bb91b7285..350642019df62025ec8aca5232407fad8e46512f 100644 (file)
@@ -1178,7 +1178,8 @@ void Curl_http2_done(struct connectdata *conn, bool premature)
       httpc->pause_stream_id = 0;
     }
   }
-  if(http->stream_id) {
+  /* -1 means unassigned and 0 means cleared */
+  if(http->stream_id > 0) {
     int rv = nghttp2_session_set_stream_user_data(httpc->h2,
                                                   http->stream_id, 0);
     if(rv) {