summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/stringio/stringio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 11fe8ef455..07ee38dd48 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -53,7 +53,9 @@ static void
strio_mark(ptr)
struct StringIO *ptr;
{
- rb_gc_mark(ptr->string);
+ if (ptr) {
+ rb_gc_mark(ptr->string);
+ }
}
static void
@@ -181,7 +183,6 @@ static VALUE
strio_s_allocate(klass)
VALUE klass;
{
- struct StringIO *ptr;
return Data_Wrap_Struct(klass, strio_mark, strio_free, 0);
}