From b1aff1a80d40dd8425586b81bbb813ac38298dbb Mon Sep 17 00:00:00 2001 From: alistairjevans Date: Wed, 25 Feb 2026 13:36:18 +0000 Subject: [PATCH] Don't over-allocate --- ext/hyper_ruby/src/request.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/hyper_ruby/src/request.rs b/ext/hyper_ruby/src/request.rs index 461c3d9..9239f2b 100644 --- a/ext/hyper_ruby/src/request.rs +++ b/ext/hyper_ruby/src/request.rs @@ -30,7 +30,7 @@ trait FillBuffer { let existing_capacity = rb_str_capacity(inner) as i64; if existing_capacity < body_len { - rb_str_modify_expand(inner, body_len); + rb_str_modify_expand(inner, body_len - existing_capacity); } else { rb_str_modify(inner); }