Commit 760bee39 authored by Claudio Saavedra's avatar Claudio Saavedra

tests: plug a series of leaks in different tests

parent b88978b0
......@@ -61,6 +61,7 @@ test_brotli (void)
g_byte_array_free (out_bytes, TRUE);
g_object_unref (dec);
g_free (compressed_filename);
g_free (uncompressed_filename);
g_free (contents);
}
......
......@@ -1075,9 +1075,11 @@ do_one_connection_connect_fail_test (SoupSession *session, SoupURI *uri, GQuark
(GAsyncReadyCallback)connect_finished,
&data);
g_main_loop_run (data.loop);
g_main_loop_unref (data.loop);
g_assert (!data.stream);
g_assert_error (data.error, domain, code);
g_clear_error (&data.error);
while (*data.events) {
soup_test_assert (!*data.events,
......
......@@ -377,6 +377,7 @@ do_remove_feature_test (void)
g_main_loop_run(loop);
g_main_loop_unref (loop);
g_object_unref (msg);
soup_uri_free (uri);
}
......
......@@ -110,6 +110,7 @@ hsts_db_session_new (void)
SOUP_SESSION_ADD_FEATURE, hsts_db,
NULL);
g_signal_connect (session, "request-queued", G_CALLBACK (on_request_queued), NULL);
g_object_unref (hsts_db);
return session;
}
......
......@@ -150,13 +150,18 @@ static SoupSession *
hsts_session_new (SoupHSTSEnforcer *enforcer)
{
SoupSession *session;
if (!enforcer)
enforcer = soup_hsts_enforcer_new ();
session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
SOUP_SESSION_ADD_FEATURE, enforcer,
NULL);
if (enforcer)
session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
SOUP_SESSION_ADD_FEATURE, enforcer,
NULL);
else
session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC,
SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_HSTS_ENFORCER,
NULL);
g_signal_connect (session, "request-queued", G_CALLBACK (on_request_queued), NULL);
return session;
......@@ -306,6 +311,7 @@ do_hsts_superdomain_test (void)
/* This should work, as we have a long-lasting policy in place. If it fails,
the subdomain policy has modified the superdomain's policy, which is wrong. */
session_get_uri (session, "http://localhost", SOUP_STATUS_OK);
g_object_unref (enforcer);
}
static void
......
......@@ -1199,6 +1199,7 @@ send_compressed_fragments_server_thread (gpointer user_data)
g_assert_no_error (error);
deflateEnd (&zstream);
g_byte_array_free (data, TRUE);
return NULL;
}
......@@ -1741,6 +1742,7 @@ send_compressed_fragments_error_server_thread (gpointer user_data)
g_assert_no_error (error);
deflateEnd (&zstream);
g_byte_array_free (data, TRUE);
return NULL;
}
......
......@@ -473,6 +473,7 @@ verify_serialization_fail (GVariant *value)
body = soup_xmlrpc_build_request ("MyMethod", value, &error);
g_assert (body == NULL);
g_assert (error != NULL);
g_clear_error (&error);
}
static void
......@@ -565,6 +566,7 @@ verify_deserialization (GVariant *expected_variant,
soup_xmlrpc_params_free (out_params);
g_variant_unref (variant);
g_variant_unref (expected_variant);
g_free (method_name);
g_free (body);
}
......@@ -591,6 +593,8 @@ verify_deserialization_fail (const char *signature,
g_assert (variant == NULL);
g_free (body);
g_free (method_name);
g_clear_error (&error);
soup_xmlrpc_params_free (out_params);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment