X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=crypto%2Fdeflate.c;h=f209368d62aefab5c1c1998f2af20159d5323d6b;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=77d7655d316aed05ef28f211df4027370b9412f2;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/crypto/deflate.c b/crypto/deflate.c index 77d7655d3..f209368d6 100644 --- a/crypto/deflate.c +++ b/crypto/deflate.c @@ -73,12 +73,11 @@ static int deflate_decomp_init(struct deflate_ctx *ctx) int ret = 0; struct z_stream_s *stream = &ctx->decomp_stream; - stream->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL); + stream->workspace = kzalloc(zlib_inflate_workspacesize(), GFP_KERNEL); if (!stream->workspace ) { ret = -ENOMEM; goto out; } - memset(stream->workspace, 0, zlib_inflate_workspacesize()); ret = zlib_inflateInit2(stream, -DEFLATE_DEF_WINBITS); if (ret != Z_OK) { ret = -EINVAL; @@ -93,11 +92,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); }