提交 9bd8e933 编写于 作者: L Li Ping 提交者: Michael Tokarev

qga-win32: 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: NLi Ping <li.ping288@zte.com.cn>
Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 32fb354b
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册