Skip to content

Commit 9c53258

Browse files
authored
bugfix: fixed memory leak in debug log.
1 parent 1a1e49b commit 9c53258

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ngx_stream_lua_logby.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ ngx_stream_lua_log_handler(ngx_stream_session_t *r)
7777
#if (NGX_STREAM_LUA_HAVE_MALLOC_TRIM)
7878
ngx_uint_t trim_cycle, trim_nreq;
7979
ngx_stream_lua_main_conf_t *lmcf;
80+
#if (NGX_DEBUG)
81+
ngx_int_t trim_ret;
82+
#endif
8083
#endif
8184
ngx_stream_lua_loc_conf_t *llcf;
8285
ngx_stream_lua_ctx_t *ctx;
@@ -96,8 +99,9 @@ ngx_stream_lua_log_handler(ngx_stream_session_t *r)
9699
lmcf->malloc_trim_req_count = 0;
97100

98101
#if (NGX_DEBUG)
102+
trim_ret = malloc_trim(1);
99103
ngx_log_debug1(NGX_LOG_DEBUG_STREAM, r->connection->log, 0,
100-
"malloc_trim(1) returned %d", malloc_trim(1));
104+
"malloc_trim(1) returned %d", trim_ret);
101105
#else
102106
(void) malloc_trim(1);
103107
#endif

0 commit comments

Comments
 (0)