From 692358fd8a870874faffcecb8397f96391bf8c87 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Mon, 9 Jun 2025 14:29:38 +0200 Subject: [PATCH] Cleanup after logging command --- gebs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gebs.h b/gebs.h index 1ac705b..f6ab0ff 100644 --- a/gebs.h +++ b/gebs.h @@ -418,6 +418,7 @@ char *gebs_cwd(void); int gebs_cmd_run_sync_alloc(Gebs_Allocator *alloc, Gebs_Cmd *cmd) { Gebs_String_Builder sb = {0}; + defer { gebs_sb_free_alloc(alloc, &sb); } gebs_nsl_join_alloc(alloc, cmd, &sb, " "); gebs_sb_finish_alloc(alloc, &sb); GEBS_LOGI("cmd `%s`\n", sb.items); @@ -462,6 +463,7 @@ int gebs_cmd_run_sync_alloc(Gebs_Allocator *alloc, Gebs_Cmd *cmd) int gebs_cmd_run_sync_collect_alloc(Gebs_Allocator *alloc, Gebs_Cmd *cmd, Gebs_String_Builder *sb_out) { Gebs_String_Builder sb = {0}; + defer { gebs_sb_free_alloc(alloc, &sb); } gebs_nsl_join_alloc(alloc, cmd, &sb, " "); gebs_sb_finish_alloc(alloc, &sb); GEBS_LOGI("cmd `%s`\n", sb.items);