summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2026-02-01 21:19:10 +0100
committerJean Boussier <jean.boussier@gmail.com>2026-02-01 21:57:59 +0100
commit4e196af17c334de1eb74f7bb036fec12a35b794e (patch)
tree65335f9d7441487bd1bc4846fdb4f1c4f44c775b /re.c
parenta93604b5ed813c43aca572ad64c1a7b66b715429 (diff)
Use ruby_sized_xfree
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/re.c b/re.c
index 82e9407a0a..0e169694d4 100644
--- a/re.c
+++ b/re.c
@@ -1023,7 +1023,7 @@ update_char_offset(VALUE match)
num_regs = rm->regs.num_regs;
if (rm->char_offset_num_allocated < num_regs) {
- REALLOC_N(rm->char_offset, struct rmatch_offset, num_regs);
+ SIZED_REALLOC_N(rm->char_offset, struct rmatch_offset, num_regs, rm->char_offset_num_allocated);
rm->char_offset_num_allocated = num_regs;
}
@@ -1101,7 +1101,7 @@ match_init_copy(VALUE obj, VALUE orig)
if (RMATCH_EXT(orig)->char_offset_num_allocated) {
if (rm->char_offset_num_allocated < rm->regs.num_regs) {
- REALLOC_N(rm->char_offset, struct rmatch_offset, rm->regs.num_regs);
+ SIZED_REALLOC_N(rm->char_offset, struct rmatch_offset, rm->regs.num_regs, rm->char_offset_num_allocated);
rm->char_offset_num_allocated = rm->regs.num_regs;
}
MEMCPY(rm->char_offset, RMATCH_EXT(orig)->char_offset,