From 8d271079beaf5c6e69eced2a234f59a83208717e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 30 Jul 2018 13:10:57 +0100 Subject: [Minor] Fix minor memory leak on saving stats --- src/controller.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controller.c b/src/controller.c index a9b5ab991..0f415210c 100644 --- a/src/controller.c +++ b/src/controller.c @@ -3172,6 +3172,7 @@ rspamd_controller_store_saved_stats (struct rspamd_controller_worker_ctx *ctx) { struct rspamd_stat *stat; ucl_object_t *top, *sub; + struct ucl_emitter_functions *efuncs; gint i, fd; g_assert (ctx->saved_stats_path != NULL); @@ -3217,12 +3218,14 @@ rspamd_controller_store_saved_stats (struct rspamd_controller_worker_ctx *ctx) "control_connections", 0, false); + efuncs = ucl_object_emit_fd_funcs (fd); ucl_object_emit_full (top, UCL_EMIT_JSON_COMPACT, - ucl_object_emit_fd_funcs (fd), NULL); + efuncs, NULL); ucl_object_unref (top); rspamd_file_unlock (fd, FALSE); close (fd); + ucl_object_emit_funcs_free (efuncs); } static void -- cgit v1.2.3