QEMU Guest Agent: Fix memory leak of device information set
PATCH 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]>
--- 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
Quoted 6 lines · 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<[email protected]>
Reviewed-by Marc-André Lureau <[email protected]>
Quoted 29 lines
--- 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);
Quoted 6 lines
--
1.8.3.1--
Marc-André Lureau