Skip to content

Commit

Permalink
Fixed a memory bug with RepeatedField#+.
Browse files Browse the repository at this point in the history
We need to fuse the arrays so that the second array's data
stays live.
  • Loading branch information
haberman committed Sep 11, 2021
1 parent 605ab95 commit 79ac88b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ruby/ext/google/protobuf_c/repeated_field.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ VALUE RepeatedField_plus(VALUE _self, VALUE list) {
RepeatedField* dupped = ruby_to_RepeatedField(dupped_);
upb_array *dupped_array = RepeatedField_GetMutable(dupped_);
upb_arena* arena = Arena_get(dupped->arena);
Arena_fuse(list_rptfield->arena, arena);
int size = upb_array_size(list_rptfield->array);
int i;

Expand Down

0 comments on commit 79ac88b

Please sign in to comment.