summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2023-01-16 22:16:04 +0100
committerNiels De Graef <ndegraef@redhat.com>2023-01-16 22:23:55 +0100
commit27c58b22badcdca2a783ba161496bb2a98bfd714 (patch)
tree764cc0d21a6906bc72ad4648ccb783ec5973647d
parentd4150cddfb2921f924765a977afd1ff6c2933fb1 (diff)
downloadgcr-27c58b22badcdca2a783ba161496bb2a98bfd714.tar.gz
test-ssh-agent-process: remember to free connection
In `test_restart()` we call `connect_to_process()` twice, which sets up a new `GSocketConnection` each time. That means we shouldn't forget to cleanup the first connection before calling it a second time.
-rw-r--r--gcr/test-ssh-agent-process.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcr/test-ssh-agent-process.c b/gcr/test-ssh-agent-process.c
index 8136d35..19c55fc 100644
--- a/gcr/test-ssh-agent-process.c
+++ b/gcr/test-ssh-agent-process.c
@@ -72,9 +72,9 @@ teardown (Test *test, gconstpointer unused)
static void
connect_to_process (Test *test)
{
- GError *error;
+ GError *error = NULL;
- error = NULL;
+ g_assert_null (test->connection);
test->connection = gcr_ssh_agent_process_connect (test->process, NULL, &error);
g_assert_nonnull (test->connection);
g_assert_no_error (error);
@@ -196,6 +196,7 @@ test_restart (Test *test, gconstpointer unused)
pid = gcr_ssh_agent_process_get_pid (test->process);
g_assert_cmpint (0, ==, pid);
+ g_clear_object (&test->connection);
connect_to_process (test);
pid = gcr_ssh_agent_process_get_pid (test->process);