Re: [PATCH] pl031: add finalize function to avoid memleaks

2020-02-03 Thread Pan Nengyuan
On 2/3/2020 5:58 PM, Peter Maydell wrote: > On Mon, 3 Feb 2020 at 07:47, wrote: >> >> From: Pan Nengyuan >> >> There is a memory leak when we call 'device_list_properties' with >> typename = pl031. It's easy to reproduce as follow: >> >> virsh qemu-monitor-command vm1 --pretty '{"execute":

Re: [PATCH] pl031: add finalize function to avoid memleaks

2020-02-03 Thread Peter Maydell
On Mon, 3 Feb 2020 at 07:47, wrote: > > From: Pan Nengyuan > > There is a memory leak when we call 'device_list_properties' with > typename = pl031. It's easy to reproduce as follow: > > virsh qemu-monitor-command vm1 --pretty '{"execute": > "device-list-properties", "arguments": {"typename":

Re: [PATCH] pl031: add finalize function to avoid memleaks

2020-02-03 Thread Pan Nengyuan
On 2/3/2020 3:59 PM, Richard Henderson wrote: > On 2/3/20 7:47 AM, pannengy...@huawei.com wrote: >> +static void pl031_finalize(Object *obj) >> +{ >> +PL031State *s = PL031(obj); >> +if (s->timer) { > > As far as I can see, s->timer can never be null. Yes, it's no instances, just

Re: [PATCH] pl031: add finalize function to avoid memleaks

2020-02-03 Thread Richard Henderson
On 2/3/20 7:47 AM, pannengy...@huawei.com wrote: > +static void pl031_finalize(Object *obj) > +{ > +PL031State *s = PL031(obj); > +if (s->timer) { As far as I can see, s->timer can never be null. Otherwise, Reviewed-by: Richard Henderson r~

[PATCH] pl031: add finalize function to avoid memleaks

2020-02-02 Thread pannengyuan
From: Pan Nengyuan There is a memory leak when we call 'device_list_properties' with typename = pl031. It's easy to reproduce as follow: virsh qemu-monitor-command vm1 --pretty '{"execute": "device-list-properties", "arguments": {"typename": "pl031"}}' The memory leak stack: Direct leak