[libsoup/pgriffis/clang-analyzer: 2/2] Silence some scan-build warnings




commit 8c6c2df2344c3a508f622f51a8f9031ac09d0089
Author: Patrick Griffis <pgriffis igalia com>
Date:   Fri Nov 13 14:34:35 2020 -0600

    Silence some scan-build warnings

 libsoup/auth/soup-auth-negotiate.c | 2 ++
 libsoup/soup-message-headers.c     | 2 ++
 tests/auth-test.c                  | 8 ++++----
 3 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/libsoup/auth/soup-auth-negotiate.c b/libsoup/auth/soup-auth-negotiate.c
index 46bd41bd..c022f1a9 100644
--- a/libsoup/auth/soup-auth-negotiate.c
+++ b/libsoup/auth/soup-auth-negotiate.c
@@ -202,6 +202,7 @@ soup_auth_negotiate_get_connection_authorization (SoupConnectionAuth *auth,
                }
 
                if (!soup_gss_build_response (conn, SOUP_AUTH (auth), &err)) {
+                        g_assert (err); /* Silence scan-build */
                        /* FIXME: report further upward via
                         * soup_message_get_error_message  */
                        if (conn->initialized)
@@ -276,6 +277,7 @@ soup_auth_negotiate_update_connection (SoupConnectionAuth *auth, SoupMessage *ms
                        }
                        goto out;
                } else {
+                        g_assert (err); /* Silence scan-build */
                        /* FIXME: report further upward via
                         * soup_message_get_error_message  */
                        if (conn->initialized)
diff --git a/libsoup/soup-message-headers.c b/libsoup/soup-message-headers.c
index b261460f..c84d7504 100644
--- a/libsoup/soup-message-headers.c
+++ b/libsoup/soup-message-headers.c
@@ -296,7 +296,9 @@ soup_message_headers_remove (SoupMessageHeaders *hdrs, const char *name)
 
        name = intern_header_name (name, &setter);
        while ((index = find_header (hdr_array, name, 0)) != -1) {
+#ifndef __clang_analyzer__ /* False positive for double-free */
                g_free (hdr_array[index].value);
+#endif
                g_array_remove_index (hdrs->array, index);
        }
        if (hdrs->concat)
diff --git a/tests/auth-test.c b/tests/auth-test.c
index 94a521ec..3c89932c 100644
--- a/tests/auth-test.c
+++ b/tests/auth-test.c
@@ -812,10 +812,10 @@ select_auth_test_one (SoupURI *uri,
         sad.password = password;
        soup_test_session_send_message (session, msg);
 
-       soup_test_assert (strcmp (sad.round[0].headers, first_headers) == 0,
+       soup_test_assert (g_strcmp0 (sad.round[0].headers, first_headers) == 0,
                          "Header order wrong: expected %s, got %s",
                          first_headers, sad.round[0].headers);
-       soup_test_assert (strcmp (sad.round[0].response, first_response) == 0,
+       soup_test_assert (g_strcmp0 (sad.round[0].response, first_response) == 0,
                          "Selected auth type wrong: expected %s, got %s",
                          first_response, sad.round[0].response);
 
@@ -824,10 +824,10 @@ select_auth_test_one (SoupURI *uri,
        soup_test_assert (!sad.round[1].headers || second_headers,
                          "Didn't expect a second round");
        if (second_headers && second_response) {
-               soup_test_assert (strcmp (sad.round[1].headers, second_headers) == 0,
+               soup_test_assert (g_strcmp0 (sad.round[1].headers, second_headers) == 0,
                                  "Second round header order wrong: expected %s, got %s\n",
                                  second_headers, sad.round[1].headers);
-               soup_test_assert (strcmp (sad.round[1].response, second_response) == 0,
+               soup_test_assert (g_strcmp0 (sad.round[1].response, second_response) == 0,
                                  "Second round selected auth type wrong: expected %s, got %s\n",
                                  second_response, sad.round[1].response);
        }


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