diff options
author | Martin Szulecki | 2013-11-20 16:57:21 +0100 |
---|---|---|
committer | Martin Szulecki | 2013-11-20 17:04:04 +0100 |
commit | 66c0deefae3295af4b740eea0fe4fc604929dadf (patch) | |
tree | 7acb684738efae1c85556aea7ccca516cdb736e9 /src | |
parent | 7198779b62231307f572fb4fdeb184c1a95e62d4 (diff) | |
download | idevicerestore-66c0deefae3295af4b740eea0fe4fc604929dadf.tar.gz idevicerestore-66c0deefae3295af4b740eea0fe4fc604929dadf.tar.bz2 |
img4: Make sure to free created element headers to fix memory leak
Diffstat (limited to 'src')
-rw-r--r-- | src/img4.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -117,6 +117,15 @@ int img4_stitch_component(const char* component_name, const unsigned char* compo outbuf = (unsigned char*)malloc(img4header_size + content_size); if (!outbuf) { + if (magic_header) { + free(magic_header); + } + if (blob_header) { + free(blob_header); + } + if (img4header) { + free(img4header); + } return -1; } p = outbuf; @@ -138,5 +147,15 @@ int img4_stitch_component(const char* component_name, const unsigned char* compo *img4_data = outbuf; *img4_size = (p - outbuf); + if (magic_header) { + free(magic_header); + } + if (blob_header) { + free(blob_header); + } + if (img4header) { + free(img4header); + } + return 0; } |