The map produced by make_map() owns all heap memory the same way the * loader does, so the public free routine on the wrapping collection * works equivalently — but tests build naked maps, so use this helper. */
| 73 | * loader does, so the public free routine on the wrapping collection |
| 74 | * works equivalently — but tests build naked maps, so use this helper. */ |
| 75 | static void free_map(cbm_path_alias_map_t *map) { |
| 76 | if (!map) { |
| 77 | return; |
| 78 | } |
| 79 | for (int i = 0; i < map->count; i++) { |
| 80 | free(map->entries[i].alias_prefix); |
| 81 | free(map->entries[i].alias_suffix); |
| 82 | free(map->entries[i].target_prefix); |
| 83 | free(map->entries[i].target_suffix); |
| 84 | } |
| 85 | free(map->entries); |
| 86 | free(map->base_url); |
| 87 | free(map); |
| 88 | } |
| 89 | |
| 90 | /* ── Basic wildcard alias ──────────────────────────────────────── */ |
| 91 |