[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-riscv] [Qemu-devel] coverity-spotted memory leak in hw/riscv/s
From: |
Alistair Francis |
Subject: |
Re: [Qemu-riscv] [Qemu-devel] coverity-spotted memory leak in hw/riscv/spike.c |
Date: |
Mon, 5 Nov 2018 09:54:02 -0800 |
On Mon, Nov 5, 2018 at 5:42 AM Peter Maydell <address@hidden> wrote:
>
> Hi; Coverity has noticed a memory leak in hw/riscv/spike.c:
> it malloc()s memory into config_string(), but never frees it.
> (CID 1391015). This isn't a very serious leak since the function
> only ever runs once, but it would be nice to fix this for 3.1
> (it is the only coverity error in the riscv code, and one of
> just 8 unaddressed for QEMU as a whole).
>
> Incidentally, "malloc and then snprintf" would be better
> done using g_strdup_printf(), which automatically allocates
> sufficient memory for the string, avoiding the need to
> try to pre-calculate the right size.
I can check this out today. Thanks for pointing it out.
Alistair
>
> thanks
> -- PMM
>