summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2018-06-25 16:05:49 +0200
committerMilan Crha <mcrha@redhat.com>2018-06-25 16:05:49 +0200
commit8f77b47d11c95a28a120814cc87cd85d21dd106f (patch)
treeb42230507318bb151d21c15f56f3cedac1f0a69c
parent87a624bfdfa35eecb8ba2ca482fe833341444b68 (diff)
downloadlibsoup-8f77b47d11c95a28a120814cc87cd85d21dd106f.tar.gz
test-utils: Fix uninitialized value issue found by Coverity Scan and clang
https://bugzilla.gnome.org/show_bug.cgi?id=781771
-rw-r--r--tests/test-utils.c6
1 files 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;