zlib's inflateInit() allocated some resourced to maintain the deflate process.
So, if should be released before the exit (coverity issue number:
1830902).
Change-Id: Ie09037f2ebce1b1dbc5ba28037151b19025dd722
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
std::unique_ptr<uint8_t[]> in(new(std::nothrow) uint8_t[bufSize]);
std::unique_ptr<uint8_t[]> out(new(std::nothrow) uint8_t[bufSize]);
if ((in == nullptr) || (out == nullptr)) {
- fprintf(stderr, "Could not allocate memory");
+ fprintf(stderr, "Could not allocate memory\n");
+ result = deflateEnd(&zs);
+ if (result != Z_OK)
+ fprintf(stderr, "error cleaning up zlib: %d\n", result);
close(traceFD);
if (backup_fd > -1)
close(backup_fd);