firmware-utils/mkfwimage: fix possible memory and resource leak
[openwrt/openwrt.git] / tools / firmware-utils / src / mkfwimage.c
index c8737386a214ed9e53f6163e406d22289180f59e..9e6d8f5b9ab4b62305ba10e6c670a53ee8e7b2ee 100644 (file)
@@ -110,6 +110,15 @@ struct fw_info fw_info[] = {
                },
                .sign = false,
        },
+       {
+               .name = "SW",
+               .fw_layout = {
+                       .kern_start     =       0x9f050000,
+                       .kern_entry     =       0x80002000,
+                       .firmware_max_length=   0x00760000,
+               },
+               .sign = false,
+       },
        {
                .name = "UBDEV01",
                .fw_layout = {
@@ -128,6 +137,15 @@ struct fw_info fw_info[] = {
                },
                .sign = true,
        },
+       {
+               .name = "ACB-ISP",
+               .fw_layout = {
+                       .kern_start     =       0x9f050000,
+                       .kern_entry     =       0x80002000,
+                       .firmware_max_length=   0x00F60000,
+               },
+               .sign = true,
+       },
        {
                .name = "",
        },
@@ -437,6 +455,7 @@ static int build_image(image_info_t* im)
        if ((f = fopen(im->outputfile, "w")) == NULL)
        {
                ERROR("Can not create output file: '%s'\n", im->outputfile);
+               free(mem);
                return -10;
        }
 
@@ -444,6 +463,8 @@ static int build_image(image_info_t* im)
        {
                ERROR("Could not write %d bytes into file: '%s'\n",
                                mem_size, im->outputfile);
+               free(mem);
+               fclose(f);
                return -11;
        }