From: Vsevolod Stakhov Date: Mon, 30 Jul 2018 12:10:57 +0000 (+0100) Subject: [Minor] Fix minor memory leak on saving stats X-Git-Tag: 1.7.9~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8d271079beaf5c6e69eced2a234f59a83208717e;p=rspamd.git [Minor] Fix minor memory leak on saving stats --- 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