The buffers and buffer sizes should be initialized and allocated. This patch fixes a possible case where vdagent can get stuck, as the function _pfnQueryDisplayConfig can return ERROR_INVALID_PARAMETER if the buffers aren't intialized. The call to free_config_buffers is superfluous because it is called inside get_config_buffers. Signed-off-by: Sameeh Jubran <sameeh@xxxxxxxxxx> --- vdagent/display_configuration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vdagent/display_configuration.cpp b/vdagent/display_configuration.cpp index bab4c95..872cbf6 100644 --- a/vdagent/display_configuration.cpp +++ b/vdagent/display_configuration.cpp @@ -700,7 +700,8 @@ CCD::~CCD() bool CCD::query_display_config() { LONG query_error(ERROR_SUCCESS); - + if (!get_config_buffers()) + return false; //Until we get it or error != ERROR_INSUFFICIENT_BUFFER do { query_error = _pfnQueryDisplayConfig(QDC_ALL_PATHS, &_numPathElements, _pPathInfo, @@ -711,7 +712,6 @@ bool CCD::query_display_config() //(see https://msdn.microsoft.com/en-us/library/windows/hardware/ff569215(v=vs.85).aspx ) if (query_error) { if (query_error == ERROR_INSUFFICIENT_BUFFER) { - free_config_buffers(); if (!get_config_buffers()) return false; } else { -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel