diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-31 22:27:49 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-31 23:20:40 +0900 |
commit | 31c427511c71f9491697cbdfc02731ad04ea57c6 (patch) | |
tree | b52e4573c712c2e023911af506824ca09ea7c499 /ext/zlib | |
parent | bfec03f5fe5123175f079b4112c1f2ed5f95e5ae (diff) | |
download | ruby-31c427511c71f9491697cbdfc02731ad04ea57c6.tar.gz |
[ruby/zlib] Revert "Don't print out warnings when freeing."
https://github.com/ruby/zlib/commit/931aa7a272
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/zlib.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index b129e2eeb5..794cf3b103 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -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) { @@ -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 }; |