修复 http2_plugin_timer_gc_cb() 内存泄露的 bug, gc_cb() 目前虽未被调用,一旦使用则会产生内存泄露

This commit is contained in:
luwenpeng
2019-08-05 10:50:03 +08:00
parent b5b52e54fa
commit 29a0121134

View File

@@ -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; 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); 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 static int