[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/6] s390x: fix memleaks in cpu_finalize

From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 1/6] s390x: fix memleaks in cpu_finalize
Date: Thu, 27 Feb 2020 09:55:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2/27/20 9:41 AM, David Hildenbrand wrote:
On 27.02.20 03:50, Pan Nengyuan wrote:
This patch fix memleaks when we call tests/qtest/cpu-plug-test on s390x. The 
leak stack is as follow:

Direct leak of 48 byte(s) in 1 object(s) allocated from:
     #0 0x7fb43c7cd970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
     #1 0x7fb43be2149d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
     #2 0x558ba96da716 in timer_new_full 
     #3 0x558ba96da716 in timer_new 
     #4 0x558ba96da716 in timer_new_ns 
     #5 0x558ba96da716 in s390_cpu_initfn 
     #6 0x558ba9c969ab in object_init_with_type 
     #7 0x558ba9c9eb5f in object_initialize_with_type 
     #8 0x558ba9c9f053 in object_new_with_type 
     #9 0x558ba967ede6 in s390x_new_cpu 
     #10 0x558ba99764b3 in hmp_cpu_add 
     #11 0x558ba9b1c27f in handle_hmp_command 
     #12 0x558ba96c1b02 in qmp_human_monitor_command 

Reported-by: Euler Robot <address@hidden>
Signed-off-by: Pan Nengyuan <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: David Hildenbrand <address@hidden>
Cc: Cornelia Huck <address@hidden>
Cc: address@hidden
- Similarly to other cleanups, move timer_new into realize(Suggested by 
Philippe Mathieu-Daudé)
- Also do the timer_free in unrealize, it seems more balance.

As I already said, I think this is init and not realize stuff. Do we
have a convention now and documented that?

The clearer doc I read so far is this post:
(but see the thread for more helpful comments)

Another thread that you might find interesting is "how to handle QOM 'container' objects whose contents depend on QOM properties?"

Anyhow, I don't really care

Well, looking at the time spent on these series and their review, having it better documented might save time the whole community.

@@ -453,6 +466,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
device_class_set_parent_realize(dc, s390_cpu_realizefn,
+    dc->unrealize = s390_cpu_unrealizefn;

Shouldn't we use device_class_set_parent_unrealize?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]