summaryrefslogtreecommitdiff
path: root/plugin/protocol/http2/src/http2_plugin.cpp
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2019-08-05 10:50:03 +0800
committerluwenpeng <[email protected]>2019-08-05 10:50:03 +0800
commit29a0121134eebffba0ef89366b4f55458b577f5e (patch)
tree7400e92bc6b57d55f8364c5f4e91f5f2f1882ee1 /plugin/protocol/http2/src/http2_plugin.cpp
parentb5b52e54fa1ef680f32e16bf561926730ff8057b (diff)
修复 http2_plugin_timer_gc_cb() 内存泄露的 bug, gc_cb() 目前虽未被调用,一旦使用则会产生内存泄露
Diffstat (limited to 'plugin/protocol/http2/src/http2_plugin.cpp')
-rw-r--r--plugin/protocol/http2/src/http2_plugin.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/protocol/http2/src/http2_plugin.cpp b/plugin/protocol/http2/src/http2_plugin.cpp
index 9dc41ce..24caa62 100644
--- a/plugin/protocol/http2/src/http2_plugin.cpp
+++ b/plugin/protocol/http2/src/http2_plugin.cpp
@@ -63,6 +63,12 @@ UNUSED static void http2_plugin_timer_gc_cb(evutil_socket_t fd, short what, void
{
struct tfe_h2_stream *h2_stream_info = (struct tfe_h2_stream *)arg;
sess_data_ctx_fini(h2_stream_info, NULL, h2_stream_info->thread_id);
+
+ // Although this function is not called now,
+ // there is a potential bug in memory leaks where it is called.
+ // A better practice is to free the memory in the sess_data_ctx_fini() function.
+ free(h2_stream_info);
+ h2_stream_info = NULL;
}
static int