summaryrefslogtreecommitdiff
path: root/io_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'io_buffer.c')
-rw-r--r--io_buffer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/io_buffer.c b/io_buffer.c
index 91083cd7e4..1ff3935094 100644
--- a/io_buffer.c
+++ b/io_buffer.c
@@ -1422,6 +1422,11 @@ rb_io_buffer_resize(VALUE self, size_t size)
#endif
if (data->flags & RB_IO_BUFFER_INTERNAL) {
+ if (size == 0) {
+ io_buffer_free(data);
+ return;
+ }
+
void *base = realloc(data->base, size);
if (!base) {