[libvirt] [PATCH] qemuAgentDispose: Reset lastError

When an error occurred in qemuAgentIO, it will be saved in mon->lastError, but it will not be freed at last. So I add the following code to fix it. ==22219== 54 bytes in 1 blocks are definitely lost in loss record 982 of 1,379 ==22219== at 0x4C26B9B: malloc (vg_replace_malloc.c:263) ==22219== by 0x8520521: strdup (in /lib64/libc-2.11.3.so) ==22219== by 0x52E99CB: virStrdup (virstring.c:554) ==22219== by 0x52B44C4: virCopyError (virerror.c:195) ==22219== by 0x52B5123: virCopyLastError (virerror.c:312) ==22219== by 0x10905877: qemuAgentIO (qemu_agent.c:660) ==22219== by 0x52B6122: virEventPollDispatchHandles (vireventpoll.c:501) ==22219== by 0x52B7AEA: virEventPollRunOnce (vireventpoll.c:647) ==22219== by 0x52B5C1B: virEventRunDefaultImpl (virevent.c:274) ==22219== by 0x54181FD: virNetServerRun (virnetserver.c:1112) ==22219== by 0x11EF4D: main (libvirtd.c:1513) Signed-off-by: Zhou Yimin <zhouyimin@huawei.com> --- src/qemu/qemu_agent.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 2cd0ccc..4a3820c 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -161,6 +161,7 @@ static void qemuAgentDispose(void *obj) (mon->cb->destroy)(mon, mon->vm); virCondDestroy(&mon->notify); VIR_FREE(mon->buffer); + virResetError(&mon->lastError); } static int -- 1.7.3.1.msysgit.0 Best Regards, -WangYufei

On 12/02/2013 07:59 PM, Wangyufei (James) wrote:
When an error occurred in qemuAgentIO, it will be saved in mon->lastError, but it will not be freed at last. So I add the following code to fix it.
==22219== 54 bytes in 1 blocks are definitely lost in loss record 982 of 1,379 ==22219== at 0x4C26B9B: malloc (vg_replace_malloc.c:263) ==22219== by 0x8520521: strdup (in /lib64/libc-2.11.3.so) ==22219== by 0x52E99CB: virStrdup (virstring.c:554) ==22219== by 0x52B44C4: virCopyError (virerror.c:195) ==22219== by 0x52B5123: virCopyLastError (virerror.c:312) ==22219== by 0x10905877: qemuAgentIO (qemu_agent.c:660) ==22219== by 0x52B6122: virEventPollDispatchHandles (vireventpoll.c:501) ==22219== by 0x52B7AEA: virEventPollRunOnce (vireventpoll.c:647) ==22219== by 0x52B5C1B: virEventRunDefaultImpl (virevent.c:274) ==22219== by 0x54181FD: virNetServerRun (virnetserver.c:1112) ==22219== by 0x11EF4D: main (libvirtd.c:1513)
Signed-off-by: Zhou Yimin <zhouyimin@huawei.com> --- src/qemu/qemu_agent.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
ACK and pushed. I amended the commit message to mention that the leak appears to have been present since the beginning of this file (commit c160ce).
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 2cd0ccc..4a3820c 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -161,6 +161,7 @@ static void qemuAgentDispose(void *obj) (mon->cb->destroy)(mon, mon->vm); virCondDestroy(&mon->notify); VIR_FREE(mon->buffer); + virResetError(&mon->lastError); }
static int
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 12/04/2013 02:44 PM, Eric Blake wrote:
On 12/02/2013 07:59 PM, Wangyufei (James) wrote:
When an error occurred in qemuAgentIO, it will be saved in mon->lastError, but it will not be freed at last.
Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
I've already pushed, but note that the commit is now attributed to Wangyufei even though the S-o-B is from Zhou Yimin. I hope this didn't create a situation of a misattributed patch. Remember that 'git send-email' can be configured to add a 'From: ...' line at the top of messages to ensure that on the receiving end, doing 'git am' will pick the correct author name even if it differs from the person sending the patch. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

In fact the patch is attributed to Zhou Yimin. Well, it's my fault, next time I'll add information like this:
From b35621412f94df8e2db165aa85d153a5facc6fa1 Mon Sep 17 00:00:00 2001 From: Zhou Yimin <zhouyimin@huawei.com> Date: Tue, 3 Dec 2013 09:54:01 +0800 Subject: [PATCH] qemuAgentDispose: Reset lastError
When an error occurred in qemuAgentIO, it will be saved in mon->lastError, but it will not be freed at last. So I add the following code to fix it.
-----Original Message----- From: Eric Blake [mailto:eblake@redhat.com] Sent: Thursday, December 05, 2013 5:51 AM To: Wangyufei (James); libvir-list@redhat.com Cc: zhouyimin Zhou(Yimin); Wangrui (K) Subject: Re: [libvirt] [PATCH] qemuAgentDispose: Reset lastError
On 12/04/2013 02:44 PM, Eric Blake wrote:
On 12/02/2013 07:59 PM, Wangyufei (James) wrote:
When an error occurred in qemuAgentIO, it will be saved in mon->lastError, but it will not be freed at last.
Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
I've already pushed, but note that the commit is now attributed to Wangyufei even though the S-o-B is from Zhou Yimin. I hope this didn't create a situation of a misattributed patch. Remember that 'git send-email' can be configured to add a 'From: ...' line at the top of messages to ensure that on the receiving end, doing 'git am' will pick the correct author name even if it differs from the person sending the patch.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Wangyufei (James)