On Tue, 11 Mar 2025 at 13:24, Nicholas Piggin <[email protected]> wrote:
>
> From: BALATON Zoltan <[email protected]>
>
> Add support for -kernel, -initrd and -append command line options.
>
> Signed-off-by: BALATON Zoltan <[email protected]>
> Reviewed-by: Nicholas Piggin <[email protected]>
> Message-ID: 
> <489b1be5d95d5153e924c95b0691b8b53f9ffb9e.1740673173.git.bala...@eik.bme.hu>
> Signed-off-by: Nicholas Piggin <[email protected]>
> ---

Hi; Coverity reports a memory leak in this function
(CID 1641398):

> +static void create_bd_info(hwaddr addr, ram_addr_t ram_size)
> +{
> +    struct bd_info *bd = g_new0(struct bd_info, 1);

We allocate the bd_info struct here...

> +
> +    bd->bi_memsize =    cpu_to_be32(ram_size);
> +    bd->bi_flashstart = cpu_to_be32(PROM_ADDR);
> +    bd->bi_flashsize =  cpu_to_be32(1); /* match what U-Boot detects */
> +    bd->bi_bootflags =  cpu_to_be32(1);
> +    bd->bi_intfreq =    cpu_to_be32(11.5 * BUS_FREQ_HZ);
> +    bd->bi_busfreq =    cpu_to_be32(BUS_FREQ_HZ);
> +    bd->bi_baudrate =   cpu_to_be32(115200);
> +
> +    cpu_physical_memory_write(addr, bd, sizeof(*bd));

...but we never free it or keep a pointer to it.

I guess we can mark it g_autofree ?

> +}

thanks
-- PMM

Reply via email to