[libsoup] test-utils: Fix uninitialized value issue found by Coverity Scan and clang



commit 8f77b47d11c95a28a120814cc87cd85d21dd106f
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 25 16:05:49 2018 +0200

    test-utils: Fix uninitialized value issue found by Coverity Scan and clang
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781771

 tests/test-utils.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 9c742060..7a21fa02 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -676,9 +676,11 @@ soup_test_request_read_all (SoupRequest   *req,
 
        if (!SOUP_IS_SESSION_SYNC (soup_request_get_session (req)))
                data.loop = g_main_loop_new (g_main_context_get_thread_default (), FALSE);
+       else
+               data.loop = NULL;
 
        do {
-               if (SOUP_IS_SESSION_SYNC (soup_request_get_session (req))) {
+               if (!data.loop) {
                        nread = g_input_stream_read (stream, buf, sizeof (buf),
                                                     cancellable, error);
                } else {
@@ -691,7 +693,7 @@ soup_test_request_read_all (SoupRequest   *req,
                }
        } while (nread > 0);
 
-       if (!SOUP_IS_SESSION_SYNC (soup_request_get_session (req)))
+       if (data.loop)
                g_main_loop_unref (data.loop);
 
        return nread == 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]