[libsoup] Silence all static analysis warnings



commit 0bd6a9f5cbcefec39a71f0f845391ebfd0a99880
Author: Patrick Griffis <pgriffis igalia com>
Date:   Wed Nov 25 14:51:51 2020 -0600

    Silence all static analysis warnings

 .gitlab-ci.yml                     |  1 -
 libsoup/auth/soup-auth-negotiate.c |  4 ++--
 libsoup/auth/soup-auth-ntlm.c      |  2 +-
 libsoup/cache/soup-cache.c         |  1 +
 libsoup/soup-session.c             | 10 ++++------
 tests/timeout-test.c               | 17 +++++++++++++----
 6 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 25f54020..67e975d0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -37,7 +37,6 @@ fedora-test:
 
 fedora-scan:
   extends: .build
-  allow_failure: true # TODO: Fix all errors
   script:
     - meson _build -Dauto_features=enabled
     - ninja -C _build scan-build
diff --git a/libsoup/auth/soup-auth-negotiate.c b/libsoup/auth/soup-auth-negotiate.c
index 7b05f9bb..3b85255f 100644
--- a/libsoup/auth/soup-auth-negotiate.c
+++ b/libsoup/auth/soup-auth-negotiate.c
@@ -605,7 +605,7 @@ soup_gss_client_step (SoupNegotiateConnectionState *conn, const gchar *challenge
                gchar *response = g_base64_encode ((const guchar *) out.value, out.length);
                conn->response_header = g_strconcat ("Negotiate ", response, NULL);
                g_free (response);
-               maj_stat = gss_release_buffer (&min_stat, &out);
+               gss_release_buffer (&min_stat, &out);
        }
 
 out:
@@ -624,6 +624,6 @@ soup_gss_client_cleanup (SoupNegotiateConnectionState *conn)
        gss_release_name (&min_stat, &conn->server_name);
        maj_stat = gss_delete_sec_context (&min_stat, &conn->context, GSS_C_NO_BUFFER);
        if (maj_stat != GSS_S_COMPLETE)
-               maj_stat = gss_delete_sec_context (&min_stat, &conn->context, GSS_C_NO_BUFFER);
+               gss_delete_sec_context (&min_stat, &conn->context, GSS_C_NO_BUFFER);
 }
 #endif /* LIBSOUP_HAVE_GSSAPI */
diff --git a/libsoup/auth/soup-auth-ntlm.c b/libsoup/auth/soup-auth-ntlm.c
index 61b99060..6efbc4a2 100644
--- a/libsoup/auth/soup-auth-ntlm.c
+++ b/libsoup/auth/soup-auth-ntlm.c
@@ -899,7 +899,7 @@ calc_ntlmv2_response (const char *user, const char *domain,
        memcpy (p_blob += sizeof (blob_reserved), &blob_timestamp, sizeof (blob_timestamp));
        memcpy (p_blob += sizeof (blob_timestamp), client_nonce, sizeof (client_nonce));
        memcpy (p_blob += sizeof (client_nonce), blob_unknown, sizeof (blob_unknown));
-       memcpy (p_blob += sizeof (blob_unknown), target_info, target_info_sz);
+       memcpy (p_blob + sizeof (blob_unknown), target_info, target_info_sz);
 
        /* create HMAC-MD5 hash of concatenated nonce and blob */
        nonce_blob = g_malloc (NTLM_CHALLENGE_NONCE_LENGTH + blob_sz);
diff --git a/libsoup/cache/soup-cache.c b/libsoup/cache/soup-cache.c
index 55c0555c..c78c6224 100644
--- a/libsoup/cache/soup-cache.c
+++ b/libsoup/cache/soup-cache.c
@@ -1105,6 +1105,7 @@ soup_cache_has_response (SoupCache *cache, SoupMessage *msg)
        if (item != lru_item) {
                priv->lru_start = g_list_remove_link (priv->lru_start, lru_item);
                item = g_list_insert_sorted (item, lru_item->data, lru_compare_func);
+                (void)item; // Silence scan-build warning
                g_list_free (lru_item);
        }
 
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index e51602ee..296f9d06 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -3332,10 +3332,8 @@ soup_session_read_uri_finish (SoupSession  *session,
                 data = g_task_get_task_data (task);
                 if (content_length)
                         *content_length = data->content_length;
-                if (content_type) {
-                        *content_type = data->content_type;
-                        data->content_type = NULL;
-                }
+                if (content_type)
+                        *content_type = g_steal_pointer (&data->content_type);
         }
 
         return g_task_propagate_pointer (task, error);
@@ -3460,8 +3458,8 @@ session_read_uri_async_ready_cb (SoupSession  *session,
                                  GTask        *task)
 {
         GInputStream *stream;
-        goffset content_length;
-        char *content_type;
+        goffset content_length = 0;
+        char *content_type = NULL;
         GOutputStream *ostream;
         GError *error = NULL;
 
diff --git a/tests/timeout-test.c b/tests/timeout-test.c
index 0cbfd5b5..0e4128d2 100644
--- a/tests/timeout-test.c
+++ b/tests/timeout-test.c
@@ -6,6 +6,7 @@
 
 static gboolean slow_https;
 
+#if 0
 static void
 message_finished (SoupMessage *msg, gpointer user_data)
 {
@@ -23,6 +24,7 @@ request_started_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
        *ret = soup_connection_get_socket (conn);
 }
 
+
 static void
 do_message_to_session (SoupSession *session, GUri *uri,
                       const char *comment, guint expected_status)
@@ -104,17 +106,20 @@ do_msg_tests_for_session (SoupSession *timeout_session,
                g_object_unref (plain_first);
        }
 }
+#endif
 
 static void
 do_async_timeout_tests (gconstpointer data)
 {
+       g_test_skip ("FIXME");
+       return;
+#if 0
        SoupSession *timeout_session, *idle_session, *plain_session;
        GUri *fast_uri = (GUri *)data;
        GUri *slow_uri = g_uri_parse_relative (fast_uri, "/slow", SOUP_HTTP_URI_FLAGS, NULL);
        gboolean extra_slow;
 
-       g_test_skip ("FIXME");
-       return;
+
 
        if (soup_uri_is_https (fast_uri, NULL)) {
                SOUP_TEST_SKIP_IF_NO_TLS;
@@ -140,18 +145,21 @@ do_async_timeout_tests (gconstpointer data)
        soup_test_session_abort_unref (plain_session);
 
        g_uri_unref (slow_uri);
+#endif
 }
 
 static void
 do_sync_timeout_tests (gconstpointer data)
 {
+        g_test_skip ("FIXME");
+       return;
+#if 0
        SoupSession *timeout_session, *plain_session;
        GUri *fast_uri = (GUri *)data;
        GUri *slow_uri = g_uri_parse_relative (fast_uri, "/slow", SOUP_HTTP_URI_FLAGS, NULL);
        gboolean extra_slow;
 
-       g_test_skip ("FIXME");
-       return;
+
 
        if (soup_uri_is_https (fast_uri, NULL)) {
                SOUP_TEST_SKIP_IF_NO_TLS;
@@ -169,6 +177,7 @@ do_sync_timeout_tests (gconstpointer data)
        soup_test_session_abort_unref (plain_session);
 
        g_uri_unref (slow_uri);
+#endif
 }
 
 static gboolean


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