Skip to content

Commit 7bba6d1

Browse files
authored
bugfix: fixed memory leak in debug log.
1 parent 8f12a28 commit 7bba6d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ngx_http_lua_logby.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ ngx_http_lua_log_handler(ngx_http_request_t *r)
6969
#if (NGX_HTTP_LUA_HAVE_MALLOC_TRIM)
7070
ngx_uint_t trim_cycle, trim_nreq;
7171
ngx_http_lua_main_conf_t *lmcf;
72+
#if (NGX_DEBUG)
73+
ngx_int_t trim_ret;
74+
#endif
7275
#endif
7376
ngx_http_lua_loc_conf_t *llcf;
7477
ngx_http_lua_ctx_t *ctx;
@@ -88,8 +91,9 @@ ngx_http_lua_log_handler(ngx_http_request_t *r)
8891
lmcf->malloc_trim_req_count = 0;
8992

9093
#if (NGX_DEBUG)
94+
trim_ret = malloc_trim(1);
9195
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
92-
"malloc_trim(1) returned %d", malloc_trim(1));
96+
"malloc_trim(1) returned %d", trim_ret);
9397
#else
9498
(void) malloc_trim(1);
9599
#endif

0 commit comments

Comments
 (0)