g_assert (g_app_info_launch_uris (appinfo, l, NULL, &error));
g_assert_no_error (error);
g_list_free (l);
+
+ g_object_unref (appinfo);
}
static void
g_cond_signal (&test1_cond);
g_mutex_unlock (&test1_mutex);
+ g_main_context_pop_thread_default (context);
+ g_main_context_unref (context);
+
return NULL;
}
g_source_remove (default_timeout);
g_source_destroy (thread_default_timeout);
g_source_unref (thread_default_timeout);
+
+ g_main_context_pop_thread_default (context);
+ g_main_context_unref (context);
}
static gboolean
main (int argc, char **argv)
{
GError *error = NULL;
+ int ret;
g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/gio/contexts/thread-independence", test_thread_independence);
g_test_add_func ("/gio/contexts/context-independence", test_context_independence);
- return g_test_run();
+ ret = g_test_run();
+
+ g_free (test_file_buffer);
+
+ return ret;
}
g_output_stream_splice (ostream2, cistream1, 0, NULL, &error);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT);
+ g_error_free (error);
g_object_unref (istream1);
g_object_unref (decompressor);
gpointer user_data)
{
CreateDeleteData *data = user_data;
+ gchar *path;
- g_assert_cmpstr (data->monitor_path, ==, g_file_get_path (file));
+ path = g_file_get_path (file);
+ g_assert_cmpstr (data->monitor_path, ==, path);
+ g_free (path);
if (event_type == G_FILE_MONITOR_EVENT_CREATED)
data->monitor_created++;
test_attributes (item, info);
g_object_unref (child);
+ g_object_unref (info);
}
/* read and test the pattern file */
g_assert (info != NULL);
size = g_file_info_get_size (info);
g_assert_cmpint (size, ==, PATTERN_FILE_SIZE);
+ g_object_unref (info);
error = NULL;
ins = g_file_read (child, NULL, &error);
g_object_unref (descend);
error = NULL;
+ g_object_unref (info);
+ g_free (relative_path);
+
info = g_file_enumerator_next_file (enumerator, NULL, &error);
}
g_assert_no_error (error);
error->code, error->message);
g_assert_cmpint (res, ==, TRUE);
g_assert_no_error (error);
+ g_object_unref (os);
}
g_object_unref (child);
}
&error);
g_assert_cmpint (res, ==, TRUE);
g_assert_no_error (error);
+ g_object_unref (input_stream);
}
g_object_unref (child);
}
GError *error;
guint i;
struct StructureItem item;
+ gchar *path;
g_assert (test_data != NULL);
log ("\n");
g_assert (child != NULL);
/* we don't care about result here */
- log (" Deleting %s, path = %s\n", item.filename,
- g_file_get_path (child));
+ path = g_file_get_path (child);
+ log (" Deleting %s, path = %s\n", item.filename, path);
+ g_free (path);
+
error = NULL;
if ((item.extra_flags & TEST_DELETE_NORMAL) == TEST_DELETE_NORMAL)
res = g_file_delete (child, NULL, &error);
g_assert (root != NULL);
- error = NULL;
enumerator =
g_file_enumerate_children (parent, "*",
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL,
- &error);
+ NULL);
if (! enumerator)
return;
g_assert (descend != NULL);
relative_path = g_file_get_relative_path (root, descend);
g_assert (relative_path != NULL);
+ g_free (relative_path);
log (" deleting '%s'\n", g_file_info_get_display_name (info));
g_object_unref (descend);
error = NULL;
+ g_object_unref (info);
+
info = g_file_enumerator_next_file (enumerator, NULL, &error);
}
g_assert_no_error (error);
return g_test_run ();
}
+ g_option_context_free (context);
/* Write test - clean target directory first */
/* this can be also considered as a test - enumerate + delete */
data = g_bytes_get_data (bytes, &size);
g_assert_cmpint (size, ==, 26);
g_assert (strncmp (data, data1, 26) == 0);
+
+ g_bytes_unref (bytes);
+ g_object_unref (stream);
}
int
str = g_key_file_get_string (keyfile, "Default Applications", contenttype, &error);
g_assert_no_error (error);
g_assert_cmpstr (str, ==, "myapp.desktop");
+ g_free (str);
g_key_file_free (keyfile);
address = (GNetworkAddress*)g_network_address_parse_uri ("ftp://joe%x-@ftp.gnome.org:2020/start", 8080, &error);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
g_assert (address == NULL);
+ g_error_free (error);
}
typedef struct _ParseTest ParseTest;
g_clear_error (&error);
}
}
+
+ g_main_loop_unref (data.loop);
}
static void
}
static void
+cleanup_test (TestMask *test)
+{
+ int i;
+
+ g_object_unref (test->mask);
+ for (i = 0; test->addresses[i].string; i++)
+ g_object_unref (test->addresses[i].address);
+}
+
+static void
watch_network_changed (GNetworkMonitor *monitor,
gboolean available,
gpointer user_data)
int
main (int argc, char **argv)
{
+ int ret;
+
g_type_init ();
if (argc == 2 && !strcmp (argv[1], "--watch"))
g_test_add_func ("/network-monitor/add_networks", test_add_networks);
g_test_add_func ("/network-monitor/remove_networks", test_remove_networks);
- return g_test_run ();
+ ret = g_test_run ();
+
+ cleanup_test (&net127);
+ cleanup_test (&net10);
+ cleanup_test (&net192);
+ cleanup_test (&netlocal6);
+ cleanup_test (&netfe80);
+ g_object_unref (ip4_default);
+ g_object_unref (ip6_default);
+
+ return ret;
}
gssize nread, nwrote;
gchar command[2] = { 0, 0 };
GMainContext *context;
- GSource *source;
+ GSource *read_source, *write_source;
context = g_main_context_new ();
proxy->loop = g_main_loop_new (context, FALSE);
if (!proxy->client_sock)
{
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
+ g_error_free (error);
break;
}
else
g_socket_connect (proxy->server_sock, server.server_addr, NULL, &error);
g_assert_no_error (error);
- source = g_socket_create_source (proxy->client_sock, G_IO_IN, NULL);
- g_source_set_callback (source, (GSourceFunc)proxy_bytes, proxy, NULL);
- g_source_attach (source, context);
- g_source_unref (source);
+ read_source = g_socket_create_source (proxy->client_sock, G_IO_IN, NULL);
+ g_source_set_callback (read_source, (GSourceFunc)proxy_bytes, proxy, NULL);
+ g_source_attach (read_source, context);
- source = g_socket_create_source (proxy->server_sock, G_IO_IN, NULL);
- g_source_set_callback (source, (GSourceFunc)proxy_bytes, proxy, NULL);
- g_source_attach (source, context);
- g_source_unref (source);
+ write_source = g_socket_create_source (proxy->server_sock, G_IO_IN, NULL);
+ g_source_set_callback (write_source, (GSourceFunc)proxy_bytes, proxy, NULL);
+ g_source_attach (write_source, context);
g_main_loop_run (proxy->loop);
g_socket_close (proxy->server_sock, &error);
g_assert_no_error (error);
g_clear_object (&proxy->server_sock);
+
+ g_source_destroy (read_source);
+ g_source_unref (read_source);
+ g_source_destroy (write_source);
+ g_source_unref (write_source);
}
g_main_loop_unref (proxy->loop);
g_object_unref (proxy->server);
g_object_unref (proxy->cancellable);
+ g_free (proxy->proxy_command);
+ g_free (proxy->supported_protocol);
+ g_free (proxy->uri);
+
return NULL;
}
if (!sock)
{
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
+ g_error_free (error);
break;
}
else
}
g_object_unref (data->server);
+ g_object_unref (data->server_addr);
g_object_unref (data->cancellable);
return NULL;
addr = g_socket_connection_get_remote_address (conn, &error);
g_assert_no_error (error);
g_assert (!G_IS_PROXY_ADDRESS (addr));
+ g_object_unref (addr);
addr = g_socket_connection_get_local_address (conn, &error);
g_assert_no_error (error);
+ g_object_unref (addr);
g_assert (g_socket_connection_is_connected (conn));
}
g_assert_cmpstr (proxy_uri, ==, proxy_a.uri);
proxy_port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (addr));
g_assert_cmpint (proxy_port, ==, proxy_a.port);
+
+ g_object_unref (addr);
}
static void
g_assert_cmpstr (proxy_uri, ==, proxy_b.uri);
proxy_port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (addr));
g_assert_cmpint (proxy_port, ==, proxy_b.port);
+
+ g_object_unref (addr);
}
static void
g_thread_join (proxy_b.thread);
g_thread_join (server.server_thread);
+ g_object_unref (cancellable);
+
return result;
}
if (g_cancellable_is_cancelled (writer_cancel))
{
+ g_clear_error (&err);
g_cancellable_cancel (main_cancel);
g_object_unref (out);
return NULL;