From 3bda3230010cd6ca7c5509039e97b9147ade1613 Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Wed, 3 Feb 2016 17:43:23 +0100
Subject: [PATCH] Fix memory leak when writing compressed sav files

---
 src/data/sys-file-writer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c
index 05d42b080e..3350a34485 100644
--- a/src/data/sys-file-writer.c
+++ b/src/data/sys-file-writer.c
@@ -1420,6 +1420,7 @@ finish_zstream (struct sfm_writer *w)
   block = &w->blocks[w->n_blocks++];
   block->uncompressed_size = w->zstream.total_in;
   block->compressed_size = w->zstream.total_out;
+  deflateEnd (&w->zstream);
 }
 
 static void
-- 
2.30.2