SSLConfig: fix stale allocator names in dupe_z doc comments
Closed
RO
1mo ago+2+2+0123456789-2-2-0123456789
Follow-up to #30875, requested in https://github.com/oven-sh/bun/pull/30875#discussion_r3264310978.
Problem
- Two doc comments in
src/runtime/socket/SSLConfig.rs(lines 61 and 67) name the wrong allocator. One saysmi_freefrees thedupe_zresult. The other saysdupe_zmakes "a fresh mimalloc allocation". - Both contradict the block comment above them, which #30875 rewrote.
bun_core::dupe_zallocates withbun_alloc::default_alloc::malloc(src/bun_core/util.rs:3685).free_sensitive_cstrfrees withdefault_alloc::free(src/bun_alloc/lib.rs:1038). Undercfg(bun_asan)that is libc, not mimalloc.
Fix
- Change the two comments to say
free_sensitiveand "default-allocator allocation". No code changes. - No test. The diff is two doc-comment lines, so the compiled binary is identical before and after. There is no behavior a test can observe.
- Verified:
cargo check -p bun_runtimeis clean.bun bdbuilds and links.
Background
SSLConfigowns C strings (keys, passphrases) that the HTTP layer frees. The allocation and the free must use the same allocator. The block comment at lines 52 to 59 documents this contract. The two comments below it are the ones this PR corrects.
Notes
This PR first also carried a fix for src/install/PackageManager/security_scanner.rs. finish_spawn released the start() ref on both result arms, but StaticPipeWriter::start() already releases its own ref on Err. On the Err path this freed the writer while json_writer still pointed at it, and the cleanup guard then touched freed memory. #40478 (82123d3a61) fixed this on main: finish_spawn now returns before the deref when start() fails, and the RefPtr locals release on Drop. The rebase onto that commit dropped the security_scanner.rs hunk as superseded. Only the doc comment change remains.
No regression test: the diff changes comments only.