From 4d4f3617bdfe025aa4fe43bc9d6cb4df19d84686 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 16 Jan 2019 15:23:12 +0100 Subject: [PATCH] Fixed memory leak in lodepng. --- winpr/libwinpr/utils/lodepng/lodepng.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/winpr/libwinpr/utils/lodepng/lodepng.c b/winpr/libwinpr/utils/lodepng/lodepng.c index 610c2c8..5f3a4d1 100644 --- a/winpr/libwinpr/utils/lodepng/lodepng.c +++ b/winpr/libwinpr/utils/lodepng/lodepng.c @@ -2017,7 +2017,8 @@ static unsigned lodepng_deflatev(ucvector* out, const unsigned char* in, size_t if(numdeflateblocks == 0) numdeflateblocks = 1; error = hash_init(&hash, settings->windowsize); - if(error) return error; + if(error) + goto fail; for(i = 0; i < numdeflateblocks && !error; i++) { @@ -2030,6 +2031,7 @@ static unsigned lodepng_deflatev(ucvector* out, const unsigned char* in, size_t else if(settings->btype == 2) error = deflateDynamic(out, &bp, &hash, in, start, end, settings, final); } +fail: hash_cleanup(&hash); return error; -- 2.7.4