| 621 | #endif |
| 622 | |
| 623 | static void cbm_subprocess_free_config(cbm_subprocess_t *process) { |
| 624 | if (!process) { |
| 625 | return; |
| 626 | } |
| 627 | if (process->argv) { |
| 628 | for (size_t i = 0; i < process->argc; i++) { |
| 629 | free(process->argv[i]); |
| 630 | } |
| 631 | } |
| 632 | free(process->argv); |
| 633 | #ifndef _WIN32 |
| 634 | if (process->environment) { |
| 635 | for (size_t i = 0; process->environment[i]; i++) { |
| 636 | cbm_free(CBM_MEM_CLASS_OTHER, process->environment[i]); |
| 637 | } |
| 638 | } |
| 639 | #endif |
| 640 | cbm_free(CBM_MEM_CLASS_OTHER, process->environment); |
| 641 | #ifdef __APPLE__ |
| 642 | cbm_free(CBM_MEM_CLASS_OTHER, process->search_path); |
| 643 | #endif |
| 644 | free(process->bin); |
| 645 | free(process->windows_cmd_payload); |
| 646 | free(process->log_file); |
| 647 | cbm_arena_destroy(&process->stdout_arena); |
| 648 | #ifndef _WIN32 |
| 649 | cbm_git_child_env_free(process->envp); |
| 650 | #endif |
| 651 | free(process); |
| 652 | } |
| 653 | |
| 654 | static cbm_subprocess_t *cbm_subprocess_copy_opts(const cbm_proc_opts_t *opts) { |
| 655 | if (!opts || !opts->bin || !opts->bin[0]) { |
no test coverage detected