]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix minor memory leak on saving stats
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Jul 2018 12:10:57 +0000 (13:10 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Jul 2018 12:10:57 +0000 (13:10 +0100)
src/controller.c

index a9b5ab991762917198b623fa783ef51ec372c00e..0f415210c80a25b1103f76879bc333d04d93dcc1 100644 (file)
@@ -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