summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/img4.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/img4.c b/src/img4.c
index ebe2ccd..17a4664 100644
--- a/src/img4.c
+++ b/src/img4.c
@@ -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;
}