QEMU Guest Agent: Fix memory leak of device information set
PATCH RESEND 1/1 QEMU Guest Agent: Fix memory leak of device information set
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 <[email protected]>
Reviewed-by Marc-André Lureau <[email protected]>
--- qga/commands-win32.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
qga/commands-win32.c +4 -1
@@ -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);
Signature · 1 line
1.8.3.1
Michael Tokarev
AppliedQuoted 2 lines · Li Ping
The caller of SetupDiGetClassDevs must delete the returned device information
set when it is no longer needed by calling SetupDiDestroyDeviceInfoList.
Applied to -trivial, with s/QEMU Guest Agent/qga-win32/ in the Subject.
/mjt