On Mon, Sep 07, 2015 at 11:59:53AM +0200, Daniel Schultz wrote:
> +static int emmc_mlo_handler(struct bbu_handler *handler, struct bbu_data 
> *data)
> +{
> +     int ret = 0;
> +     int i = 0;
> +     int fd;
> +     const void *image = data->image;
> +     size_t size = data->len;
> +     u8 *part_table = 0;
> +
> +     if (file_detect_type(image, size) != filetype_ch_image) {
> +             pr_err("%s is not a valid ch-image\n", data->imagefile);
> +             return -EINVAL;
> +     }
> +     ret = bbu_confirm(data);
> +     if (ret != 0)
> +             return ret;
> +
> +     fd = open(handler->devicefile, O_WRONLY);
> +     if (fd < 0) {
> +             pr_err("could not open %s: %s\n", handler->devicefile,
> +                     errno_str());
> +             return fd;
> +     }
> +
> +     /* save the partition table */
> +     part_table = xmalloc(PART_TABLE_SIZE);

You forgot to free part_table later. I replaced part_table with a static
array while applying.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to