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);