* [Qemu-devel] [PATCH] QEMU Guest Agent: Fix memory leak of device information set
@ 2017-06-13 10:21 Li Ping
2017-06-13 10:38 ` Marc-André Lureau
0 siblings, 1 reply; 2+ messages in thread
From: Li Ping @ 2017-06-13 10:21 UTC (permalink / raw)
To: mdroth; +Cc: qemu-devel, Li Ping
The caller of SetupDiGetClassDevs must delete the returned device information
set when it is no longer needed by calling SetupDiDestroyDeviceInfoList.
Signed-off-by: Li Ping<li.ping288@zte.com.cn>
---
qga/commands-win32.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 439d229..6f16457 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -512,7 +512,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)
} else {
error_setg_win32(errp, GetLastError(),
"failed to get device name");
- goto out;
+ goto free_dev_info;
}
}
@@ -560,6 +560,9 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)
pci->bus = bus;
break;
}
+
+free_dev_info:
+ SetupDiDestroyDeviceInfoList(dev_info);
out:
g_free(buffer);
g_free(name);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] QEMU Guest Agent: Fix memory leak of device information set
2017-06-13 10:21 [Qemu-devel] [PATCH] QEMU Guest Agent: Fix memory leak of device information set Li Ping
@ 2017-06-13 10:38 ` Marc-André Lureau
0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2017-06-13 10:38 UTC (permalink / raw)
To: Li Ping, mdroth; +Cc: qemu-devel
On Tue, Jun 13, 2017 at 2:23 PM Li Ping <li.ping288@zte.com.cn> wrote:
> The caller of SetupDiGetClassDevs must delete the returned device
> information
> set when it is no longer needed by calling SetupDiDestroyDeviceInfoList.
>
> Signed-off-by: Li Ping<li.ping288@zte.com.cn>
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> qga/commands-win32.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> index 439d229..6f16457 100644
> --- a/qga/commands-win32.c
> +++ b/qga/commands-win32.c
> @@ -512,7 +512,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error
> **errp)
> } else {
> error_setg_win32(errp, GetLastError(),
> "failed to get device name");
> - goto out;
> + goto free_dev_info;
> }
> }
>
> @@ -560,6 +560,9 @@ static GuestPCIAddress *get_pci_info(char *guid, Error
> **errp)
> pci->bus = bus;
> break;
> }
> +
> +free_dev_info:
> + SetupDiDestroyDeviceInfoList(dev_info);
> out:
> g_free(buffer);
> g_free(name);
> --
> 1.8.3.1
>
>
>
> --
Marc-André Lureau
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-13 10:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-13 10:21 [Qemu-devel] [PATCH] QEMU Guest Agent: Fix memory leak of device information set Li Ping
2017-06-13 10:38 ` Marc-André Lureau
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).