[PATCH] crypto: call zlib end functions on deflate exit path
authorArtem B. Bityuckiy <dedekind@infradead.org>
Sat, 16 Apr 2005 22:23:58 +0000 (15:23 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 16 Apr 2005 22:23:58 +0000 (15:23 -0700)
In the deflate_[compress|uncompress|pcompress] functions we call the
zlib_[in|de]flateReset function at the beginning.  This is OK.  But when we
unload the deflate module we don't call zlib_[in|de]flateEnd to free all
the zlib internal data.  It looks like a bug for me.  Please, consider the
attached patch.

Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
crypto/deflate.c

index 77d7655d316aed05ef28f211df4027370b9412f2..bc73342cd1ecc253909440de480909b7eab10beb 100644 (file)
@@ -93,11 +93,13 @@ out_free:
 
 static void deflate_comp_exit(struct deflate_ctx *ctx)
 {
+       zlib_deflateEnd(&ctx->comp_stream);
        vfree(ctx->comp_stream.workspace);
 }
 
 static void deflate_decomp_exit(struct deflate_ctx *ctx)
 {
+       zlib_inflateEnd(&ctx->decomp_stream);
        kfree(ctx->decomp_stream.workspace);
 }