summaryrefslogtreecommitdiff
path: root/test/ruby/test_thread_queue.rb
diff options
context:
space:
mode:
authorU.Nakamura <usa@ruby-lang.org>2023-07-25 20:18:30 +0900
committerU.Nakamura <usa@ruby-lang.org>2023-07-25 20:18:30 +0900
commite7c94d9d1d2bdbf396c489d1dc653c771f59bb92 (patch)
tree5b7da587015dcfd04e109bac8e64423a45316434 /test/ruby/test_thread_queue.rb
parentcba152ff1f69fad98f4c67747dcf763407cd1883 (diff)
merge revision(s) 09295ea796900fb7b05d29e93364090e21598566: [Backport #19543]
IO::Buffer#resize: Free internal buffer if new size is zero (#7569) `#resize(0)` on an IO::Buffer with internal buffer allocated will result in calling `realloc(data->base, 0)`. The behavior of `realloc` with size = 0 is implementation-defined (glibc frees the object and returns NULL, while BSDs return an inaccessible object). And thus such usage is deprecated in standard C (upcoming C23 will make it UB). To avoid this problem, just `free`s the memory when the new size is zero. --- io_buffer.c | 5 +++++ test/ruby/test_io_buffer.rb | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+)
Diffstat (limited to 'test/ruby/test_thread_queue.rb')
0 files changed, 0 insertions, 0 deletions