Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d6bb2b

Browse files
authored
bugfix: fixed memory leak in debug log.
1 parent 2912d4b commit 0d6bb2b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/subsys/ngx_subsys_lua_logby.c.tt2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ ngx_stream_lua_log_handler(ngx_stream_session_t *r)
7373
#if (NGX_[% SUBSYS %]_LUA_HAVE_MALLOC_TRIM)
7474
ngx_uint_t trim_cycle, trim_nreq;
7575
ngx_[% subsys %]_lua_main_conf_t *lmcf;
76+
#if (NGX_DEBUG)
77+
ngx_int_t trim_ret;
78+
#endif
7679
#endif
7780
ngx_[% subsys %]_lua_loc_conf_t *llcf;
7881
ngx_[% subsys %]_lua_ctx_t *ctx;
@@ -92,8 +95,9 @@ ngx_stream_lua_log_handler(ngx_stream_session_t *r)
9295
lmcf->malloc_trim_req_count = 0;
9396

9497
#if (NGX_DEBUG)
98+
trim_ret = malloc_trim(1);
9599
ngx_log_debug1(NGX_LOG_DEBUG_[% SUBSYS %], r->connection->log, 0,
96-
"malloc_trim(1) returned %d", malloc_trim(1));
100+
"malloc_trim(1) returned %d", trim_ret);
97101
#else
98102
(void) malloc_trim(1);
99103
#endif

0 commit comments

Comments
 (0)