[Spice-commits] vdagent/display_configuration.cpp

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Aug 30 13:24:22 UTC 2016


 vdagent/display_configuration.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3856b1147aa8e10e637bfdc19d1f0dc30ce5c883
Author: Sameeh Jubran <sameeh at daynix.com>
Date:   Tue Aug 30 15:41:00 2016 +0300

    Initialize buffers before querying display config
    
    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 at daynix.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/vdagent/display_configuration.cpp b/vdagent/display_configuration.cpp
index 01fdbb0..b42fa04 100644
--- a/vdagent/display_configuration.cpp
+++ b/vdagent/display_configuration.cpp
@@ -356,7 +356,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,
@@ -367,7 +368,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 {


More information about the Spice-commits mailing list