diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> | 2024-06-27 19:25:07 +0300 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2024-06-30 19:51:44 +0300 |
commit | f22855dffdbc2906f744b5bcfea869cbb66b8fb2 (patch) | |
tree | cb030661381f78194e9c3134daa41e658c31868a | |
parent | 412d294ffdc63b56c0e512351ecc01d3a9b90d68 (diff) |
hw/core/loader: gunzip(): fix memory leak on error path
We should call inflateEnd() like on success path to cleanup state in s
variable.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | hw/core/loader.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/core/loader.c b/hw/core/loader.c index 2f8105d7de..a3bea1e718 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -610,6 +610,7 @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen) r = inflate(&s, Z_FINISH); if (r != Z_OK && r != Z_STREAM_END) { printf ("Error: inflate() returned %d\n", r); + inflateEnd(&s); return -1; } dstbytes = s.next_out - (unsigned char *) dst; |