From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Paolo Bonzini <pbonzini@redhat.com>, <qemu-devel@nongnu.org>
Cc: qemu-trivial@nongnu.org, shannon.zhao@linaro.org
Subject: Re: [Qemu-trivial] [PATCH 2/3] hw/ide/pci: Fix memory leak
Date: Tue, 26 May 2015 09:24:44 +0800 [thread overview]
Message-ID: <5563CB5C.2000603@huawei.com> (raw)
In-Reply-To: <55631FAB.4010906@redhat.com>
On 2015/5/25 21:12, Paolo Bonzini wrote:
>
>
> On 25/05/2015 10:37, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> valgrind complains about:
>> ==16447== 16 bytes in 2 blocks are definitely lost in loss record 1,304 of 3,310
>> ==16447== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>> ==16447== by 0x2E4FD7: malloc_and_trace (vl.c:2546)
>> ==16447== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> ==16447== by 0x36FB47: qemu_extend_irqs (irq.c:55)
>> ==16447== by 0x36FBD3: qemu_allocate_irqs (irq.c:64)
>> ==16447== by 0x3B4B44: bmdma_init (pci.c:464)
>> ==16447== by 0x3B547B: pci_piix_init_ports (piix.c:144)
>> ==16447== by 0x3B55D2: pci_piix_ide_realize (piix.c:164)
>> ==16447== by 0x3EAEC6: pci_qdev_realize (pci.c:1790)
>> ==16447== by 0x36C685: device_set_realized (qdev.c:1058)
>> ==16447== by 0x47179E: property_set_bool (object.c:1514)
>> ==16447== by 0x470098: object_property_set (object.c:837)
>>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>> hw/ide/pci.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/ide/pci.c b/hw/ide/pci.c
>> index 1b3d1c1..c5c4441 100644
>> --- a/hw/ide/pci.c
>> +++ b/hw/ide/pci.c
>> @@ -464,6 +464,7 @@ void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d)
>> irq = qemu_allocate_irqs(bmdma_irq, bm, 1);
>> bus->irq = *irq;
>> bm->pci_dev = d;
>> + g_free(irq);
>> }
>
> You can use qemu_allocate_irq here:
>
> bus->irq = qemu_allocate_irq(bmdma_irq, bm, 0);
>
Ok, I see. Will replace it. Thanks.
> Paolo
>
>> static const TypeInfo pci_ide_type_info = {
>>
>
>
--
Shannon
WARNING: multiple messages have this Message-ID (diff)
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, shannon.zhao@linaro.org
Subject: Re: [Qemu-devel] [PATCH 2/3] hw/ide/pci: Fix memory leak
Date: Tue, 26 May 2015 09:24:44 +0800 [thread overview]
Message-ID: <5563CB5C.2000603@huawei.com> (raw)
In-Reply-To: <55631FAB.4010906@redhat.com>
On 2015/5/25 21:12, Paolo Bonzini wrote:
>
>
> On 25/05/2015 10:37, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> valgrind complains about:
>> ==16447== 16 bytes in 2 blocks are definitely lost in loss record 1,304 of 3,310
>> ==16447== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>> ==16447== by 0x2E4FD7: malloc_and_trace (vl.c:2546)
>> ==16447== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3)
>> ==16447== by 0x36FB47: qemu_extend_irqs (irq.c:55)
>> ==16447== by 0x36FBD3: qemu_allocate_irqs (irq.c:64)
>> ==16447== by 0x3B4B44: bmdma_init (pci.c:464)
>> ==16447== by 0x3B547B: pci_piix_init_ports (piix.c:144)
>> ==16447== by 0x3B55D2: pci_piix_ide_realize (piix.c:164)
>> ==16447== by 0x3EAEC6: pci_qdev_realize (pci.c:1790)
>> ==16447== by 0x36C685: device_set_realized (qdev.c:1058)
>> ==16447== by 0x47179E: property_set_bool (object.c:1514)
>> ==16447== by 0x470098: object_property_set (object.c:837)
>>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>> hw/ide/pci.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/ide/pci.c b/hw/ide/pci.c
>> index 1b3d1c1..c5c4441 100644
>> --- a/hw/ide/pci.c
>> +++ b/hw/ide/pci.c
>> @@ -464,6 +464,7 @@ void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d)
>> irq = qemu_allocate_irqs(bmdma_irq, bm, 1);
>> bus->irq = *irq;
>> bm->pci_dev = d;
>> + g_free(irq);
>> }
>
> You can use qemu_allocate_irq here:
>
> bus->irq = qemu_allocate_irq(bmdma_irq, bm, 0);
>
Ok, I see. Will replace it. Thanks.
> Paolo
>
>> static const TypeInfo pci_ide_type_info = {
>>
>
>
--
Shannon
next prev parent reply other threads:[~2015-05-26 1:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-25 8:37 [Qemu-trivial] [PATCH 0/3] Fix memory leak spotted by valgrind Shannon Zhao
2015-05-25 8:37 ` [Qemu-devel] " Shannon Zhao
2015-05-25 8:37 ` [Qemu-trivial] [PATCH 1/3] hw/i386/pc_piix: Fix memory leak Shannon Zhao
2015-05-25 8:37 ` [Qemu-devel] " Shannon Zhao
2015-05-25 8:37 ` [Qemu-trivial] [PATCH 2/3] hw/ide/pci: " Shannon Zhao
2015-05-25 8:37 ` [Qemu-devel] " Shannon Zhao
2015-05-25 13:12 ` [Qemu-trivial] " Paolo Bonzini
2015-05-25 13:12 ` [Qemu-devel] " Paolo Bonzini
2015-05-26 1:24 ` Shannon Zhao [this message]
2015-05-26 1:24 ` Shannon Zhao
2015-05-25 8:37 ` [Qemu-trivial] [PATCH 3/3] hw/i386/acpi-build: decref after use Shannon Zhao
2015-05-25 8:37 ` [Qemu-devel] " Shannon Zhao
2015-05-25 13:57 ` [Qemu-trivial] " Igor Mammedov
2015-05-25 13:57 ` Igor Mammedov
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=5563CB5C.2000603@huawei.com \
--to=zhaoshenglong@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=shannon.zhao@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.