diff options
author | Adam Borowski <kilobyte@angband.pl> | 2010-10-07 00:21:22 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2010-10-07 00:35:26 +0200 |
commit | 30be6f76d84ae4a9254f2307f7fcb19d144e5fb5 (patch) | |
tree | b577a233d96f44a5c52045f5524b3a6598d02f1f /crawl-ref/source/package.cc | |
parent | 2d20a979dd95b082f58486da06bdb8340ceeb675 (diff) | |
download | crawl-ref-30be6f76d84ae4a9254f2307f7fcb19d144e5fb5.tar.gz crawl-ref-30be6f76d84ae4a9254f2307f7fcb19d144e5fb5.zip |
Fix a memory leak on failed writes.
Actually, I can't think of a case where such error won't be fatal, but then,
it leaves Crawl in a consistent state so we might in theory merely return to
menu (restart_after_game).
I'm fixing it mostly in case someone reuses the transactional packager for
some purpose other than Crawl.
Diffstat (limited to 'crawl-ref/source/package.cc')
-rw-r--r-- | crawl-ref/source/package.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crawl-ref/source/package.cc b/crawl-ref/source/package.cc index be98d610ca..bbe374df5c 100644 --- a/crawl-ref/source/package.cc +++ b/crawl-ref/source/package.cc @@ -586,7 +586,13 @@ chunk_writer::~chunk_writer() ASSERT(pkg->n_users > 0); pkg->n_users--; if (pkg->aborted) + { +#ifdef USE_ZLIB + // ignore errors, they're not relevant anymore + deflateEnd(&zs); +#endif return; + } #ifdef USE_ZLIB zs.avail_in = 0; |