Skip to content

Commit

Permalink
[ruby/zlib] Revert "Don't print out warnings when freeing."
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Aug 31, 2021
1 parent bfec03f commit 31c4275
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ext/zlib/zlib.c
Expand Up @@ -1226,6 +1226,17 @@ zstream_finalize(struct zstream *z)
finalizer_warn("the stream was freed prematurely.");
}

static void
zstream_free(void *p)
{
struct zstream *z = p;

if (ZSTREAM_IS_READY(z)) {
zstream_finalize(z);
}
xfree(z);
}

static size_t
zstream_memsize(const void *p)
{
Expand All @@ -1235,7 +1246,7 @@ zstream_memsize(const void *p)

static const rb_data_type_t zstream_data_type = {
"zstream",
{ zstream_mark, xfree, zstream_memsize, },
{ zstream_mark, zstream_free, zstream_memsize, },
0, 0, RUBY_TYPED_FREE_IMMEDIATELY
};

Expand Down

0 comments on commit 31c4275

Please sign in to comment.