diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # lzlib
 
+## 0.3.0.4
+
+  * Use `bracket` and fix space leak
+
 ## 0.3.0.3
 
   * Use `bracket` so that memory is freed if an exception is thrown in another
diff --git a/lzlib.cabal b/lzlib.cabal
--- a/lzlib.cabal
+++ b/lzlib.cabal
@@ -1,6 +1,6 @@
 cabal-version:      1.18
 name:               lzlib
-version:            0.3.0.3
+version:            0.3.0.4
 license:            BSD3
 license-file:       LICENSE
 copyright:          Copyright: (c) 2019 Vanessa McHale
diff --git a/src/Codec/Lzip.hs b/src/Codec/Lzip.hs
--- a/src/Codec/Lzip.hs
+++ b/src/Codec/Lzip.hs
@@ -119,10 +119,10 @@
     encoder <- lZCompressOpen (fromIntegral $ dictionarySize sz) (fromIntegral matchLenLimit) (fromIntegral memberSize)
 
     let delta = sz `div` 4 + 64
-    newBytes <- mallocBytes delta
-    res <- loop encoder bss (newBytes, delta) 0 mempty
-
-    void $ lZCompressClose encoder
+    res <-bracket
+        (mallocBytes delta)
+        ((lZCompressClose encoder *>) . free)
+        (\newBytes -> loop encoder bss (newBytes, delta) 0 mempty)
 
     pure (BSL.fromChunks res)
 
