hw/core/loader: gunzip(): fix memory leak on error path
PATCH 1/1 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 <[email protected]>
--- hw/core/loader.c | 1 + 1 file changed, 1 insertion(+)
hw/core/loader.c +1 -0
@@ -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;
Signature · 1 line
2.34.1
Quoted 7 lines · Vladimir Sementsov-Ogievskiy
We should call
inflateEnd()like on success path to cleanup state in s variable.Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- hw/core/loader.c | 1 + 1 file changed, 1 insertion(+)
Reviewed-by Philippe Mathieu-Daudé <[email protected]>