doh2: ensure memory from unsent streams is freed
The nghttp2 on_stream_close callback is only called for streams that are properly closed. If we need to tear down the HTTP connection due to any reason (e.g. IO error in underlying layer), some streams may not be propely closed.
Due to HTTP/2 flow control, we may also wait indefinitely for the data to be written. This can also cause the stream to never be properly closed.
To handle these cases, a reference of allocated data is kept and we ensure everything is freed once we're closing the http session.
Edited by Tomas Krizek