From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>, pannengyuan@huawei.com
Cc: quintela@redhat.com, zhanghailiang@huawei.com,
qemu-devel@nongnu.org, euler.robot@huawei.com
Subject: Re: [PATCH] migration/savevm: release gslist after dump_vmstate_json
Date: Thu, 27 Feb 2020 20:05:34 +0100 [thread overview]
Message-ID: <6dbc9a44-0e99-266b-11b6-d4f5b5fdb285@redhat.com> (raw)
In-Reply-To: <20200219095908.GB3089@work-vm>
On 2/19/20 10:59 AM, Dr. David Alan Gilbert wrote:
> * pannengyuan@huawei.com (pannengyuan@huawei.com) wrote:
>> From: Pan Nengyuan <pannengyuan@huawei.com>
>>
>> 'list' forgot to free at the end of dump_vmstate_json_to_file(), although it's called only once, but seems like a clean code.
>>
>> Fix the leak as follow:
>> Direct leak of 16 byte(s) in 1 object(s) allocated from:
>> #0 0x7fb946abd768 in __interceptor_malloc (/lib64/libasan.so.5+0xef768)
>> #1 0x7fb945eca445 in g_malloc (/lib64/libglib-2.0.so.0+0x52445)
>> #2 0x7fb945ee2066 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x6a066)
>> #3 0x7fb945ee3139 in g_slist_prepend (/lib64/libglib-2.0.so.0+0x6b139)
>> #4 0x5585db591581 in object_class_get_list_tramp /mnt/sdb/qemu-new/qemu/qom/object.c:1084
>> #5 0x5585db590f66 in object_class_foreach_tramp /mnt/sdb/qemu-new/qemu/qom/object.c:1028
>> #6 0x7fb945eb35f7 in g_hash_table_foreach (/lib64/libglib-2.0.so.0+0x3b5f7)
>> #7 0x5585db59110c in object_class_foreach /mnt/sdb/qemu-new/qemu/qom/object.c:1038
>> #8 0x5585db5916b6 in object_class_get_list /mnt/sdb/qemu-new/qemu/qom/object.c:1092
>> #9 0x5585db335ca0 in dump_vmstate_json_to_file /mnt/sdb/qemu-new/qemu/migration/savevm.c:638
>> #10 0x5585daa5bcbf in main /mnt/sdb/qemu-new/qemu/vl.c:4420
>> #11 0x7fb941204812 in __libc_start_main ../csu/libc-start.c:308
>> #12 0x5585da29420d in _start (/mnt/sdb/qemu-new/qemu/build/x86_64-softmmu/qemu-system-x86_64+0x27f020d)
>>
>> Indirect leak of 7472 byte(s) in 467 object(s) allocated from:
>> #0 0x7fb946abd768 in __interceptor_malloc (/lib64/libasan.so.5+0xef768)
>> #1 0x7fb945eca445 in g_malloc (/lib64/libglib-2.0.so.0+0x52445)
>> #2 0x7fb945ee2066 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x6a066)
>> #3 0x7fb945ee3139 in g_slist_prepend (/lib64/libglib-2.0.so.0+0x6b139)
>> #4 0x5585db591581 in object_class_get_list_tramp /mnt/sdb/qemu-new/qemu/qom/object.c:1084
>> #5 0x5585db590f66 in object_class_foreach_tramp /mnt/sdb/qemu-new/qemu/qom/object.c:1028
>> #6 0x7fb945eb35f7 in g_hash_table_foreach (/lib64/libglib-2.0.so.0+0x3b5f7)
>> #7 0x5585db59110c in object_class_foreach /mnt/sdb/qemu-new/qemu/qom/object.c:1038
>> #8 0x5585db5916b6 in object_class_get_list /mnt/sdb/qemu-new/qemu/qom/object.c:1092
>> #9 0x5585db335ca0 in dump_vmstate_json_to_file /mnt/sdb/qemu-new/qemu/migration/savevm.c:638
>> #10 0x5585daa5bcbf in main /mnt/sdb/qemu-new/qemu/vl.c:4420
>> #11 0x7fb941204812 in __libc_start_main ../csu/libc-start.c:308
>> #12 0x5585da29420d in _start (/mnt/sdb/qemu-new/qemu/build/x86_64-softmmu/qemu-system-x86_64+0x27f020d)
>>
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>
> Good robot!
Unfortunately it doesn't generate the documentation along...
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
>> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
>> ---
>> migration/savevm.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index f19cb9ec7a..60e6ea8a8d 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -665,6 +665,7 @@ void dump_vmstate_json_to_file(FILE *out_file)
>> }
>> fprintf(out_file, "\n}\n");
>> fclose(out_file);
>> + g_slist_free(list);
>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
>> }
>>
>> static uint32_t calculate_new_instance_id(const char *idstr)
>> --
>> 2.18.2
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
>
next prev parent reply other threads:[~2020-02-27 19:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 9:47 [PATCH] migration/savevm: release gslist after dump_vmstate_json pannengyuan
2020-02-19 9:59 ` Dr. David Alan Gilbert
2020-02-27 19:05 ` Philippe Mathieu-Daudé [this message]
2020-02-27 18:05 ` Juan Quintela
2020-02-27 19:17 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6dbc9a44-0e99-266b-11b6-d4f5b5fdb285@redhat.com \
--to=philmd@redhat.com \
--cc=dgilbert@redhat.com \
--cc=euler.robot@huawei.com \
--cc=pannengyuan@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).