diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2023-01-31 11:35:01 +0000 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2023-01-31 11:44:44 +0000 |
commit | bd5e57ef1787cb07754b5e796723050f5a604331 (patch) | |
tree | ce49ea6f692d2c175d11b44deeecea6fa9979aa8 | |
parent | f499e37979c09409d553a49562c6a0a9a65267af (diff) | |
download | glib-bd5e57ef1787cb07754b5e796723050f5a604331.tar.gz |
tests: Fix a few minor leaks in gdbus-example-peer
One leak spotted by the Coverity, the others found via valgrind.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Coverity CID: #1504322
-rwxr-xr-x | gio/tests/gdbus-example-peer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gio/tests/gdbus-example-peer.c b/gio/tests/gdbus-example-peer.c index f57d36832..29b3c2a07 100755 --- a/gio/tests/gdbus-example-peer.c +++ b/gio/tests/gdbus-example-peer.c @@ -147,7 +147,6 @@ on_new_connection (GDBusServer *server, else s = g_credentials_to_string (credentials); - g_print ("Client connected.\n" "Peer credentials: %s\n" "Negotiated capabilities: unix-fd-passing=%d\n", @@ -165,6 +164,8 @@ on_new_connection (GDBusServer *server, NULL); /* GError** */ g_assert (registration_id > 0); + g_free (s); + return TRUE; } @@ -266,10 +267,14 @@ main (int argc, char *argv[]) g_option_context_add_main_entries (opt_context, opt_entries, NULL); if (!g_option_context_parse (opt_context, &argc, &argv, &error)) { + g_option_context_free (opt_context); g_printerr ("Error parsing options: %s\n", error->message); g_error_free (error); goto out; } + + g_option_context_free (opt_context); + if (opt_address == NULL) { g_printerr ("Incorrect usage, try --help.\n"); @@ -373,6 +378,8 @@ main (int argc, char *argv[]) -1, NULL, &error); + g_free (greeting); + if (value == NULL) { g_printerr ("Error invoking HelloWorld(): %s\n", error->message); @@ -390,5 +397,7 @@ main (int argc, char *argv[]) ret = 0; out: + g_free (opt_address); + return ret; } |