diff options
author | INSUN PYO <insun.pyo@samsung.com> | 2020-09-03 20:24:26 +0900 |
---|---|---|
committer | INSUN PYO <insun.pyo@samsung.com> | 2020-09-03 20:26:37 +0900 |
commit | 0ac2ff1c88b971aeb036937c30e18117cc8f530d (patch) | |
tree | 70a82ec583af6f5dcde3a841a99440ac4afb5106 | |
parent | 6c87ef41968b7107eb1ca1f189bdc8567b79011e (diff) | |
download | session-utils-0ac2ff1c88b971aeb036937c30e18117cc8f530d.tar.gz session-utils-0ac2ff1c88b971aeb036937c30e18117cc8f530d.tar.bz2 session-utils-0ac2ff1c88b971aeb036937c30e18117cc8f530d.zip |
Fix memory leak and modify coding styletizen_6.0.m2_releasesubmit/tizen_6.0_hotfix/20201103.114805submit/tizen_6.0_hotfix/20201102.192505submit/tizen_6.0/20201029.205105submit/tizen/20200903.112836accepted/tizen/unified/20200904.154105accepted/tizen/6.0/unified/hotfix/20201103.000954accepted/tizen/6.0/unified/20201030.113114tizen_6.0_hotfixtizen_6.0accepted/tizen_6.0_unified_hotfixaccepted/tizen_6.0_unified
Change-Id: I0cab882eb9d23764e8a831da0739b2d06a3bc1e8
-rw-r--r-- | src/dbus-activation-stop-test/dbus-activation-stop-test.c | 16 | ||||
-rw-r--r-- | src/dbus-send-receive-test/dbus-send-receive-test.c | 35 |
2 files changed, 26 insertions, 25 deletions
diff --git a/src/dbus-activation-stop-test/dbus-activation-stop-test.c b/src/dbus-activation-stop-test/dbus-activation-stop-test.c index fe0036f..358ea1e 100644 --- a/src/dbus-activation-stop-test/dbus-activation-stop-test.c +++ b/src/dbus-activation-stop-test/dbus-activation-stop-test.c @@ -30,32 +30,32 @@ static GMainLoop *mainloop; static void sig_term(int signo) { - fprintf (stderr, "sig term\n"); + fprintf(stderr, "sig term\n"); } static void sig_abort(int signo) { - fprintf (stderr, "sig abort\n"); + fprintf(stderr, "sig abort\n"); sd_notify(0, "STOPPING=1"); - g_bus_unown_name (owner_id); + g_bus_unown_name(owner_id); } static void sig_quit(int signo) { - fprintf (stderr, "sig quit\n"); + fprintf(stderr, "sig quit\n"); g_main_loop_quit(mainloop); } static void name_acquire(GDBusConnection *connection, const gchar *name, gpointer user_data) { - fprintf (stderr, "name acquire : %s\n", name); + fprintf(stderr, "name acquire : %s\n", name); } static void name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data) { - fprintf (stderr, "name lost : %s\n", name); + fprintf(stderr, "name lost : %s\n", name); } int main(int argc, char *argv[]) @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (!conn || err) { - fprintf (stderr, "failed to get system bus\n"); + fprintf(stderr, "failed to get system bus\n"); return -1; } @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) name_acquire, name_lost, NULL, NULL); if (owner_id == 0) { - fprintf (stderr, "g_bus_own_name_on_connection fails\n"); + fprintf(stderr, "g_bus_own_name_on_connection fails\n"); return -1; } diff --git a/src/dbus-send-receive-test/dbus-send-receive-test.c b/src/dbus-send-receive-test/dbus-send-receive-test.c index a679565..72a1d55 100644 --- a/src/dbus-send-receive-test/dbus-send-receive-test.c +++ b/src/dbus-send-receive-test/dbus-send-receive-test.c @@ -32,12 +32,12 @@ static void name_acquire(GDBusConnection *connection, const gchar *name, gpointer user_data) { - fprintf (stderr, "name acquire : %s\n", name); + fprintf(stderr, "name acquire : %s\n", name); } static void name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data) { - fprintf (stderr, "name lost : %s\n", name); + fprintf(stderr, "name lost : %s\n", name); } static void method_call_handler (GDBusConnection *connection, @@ -52,9 +52,9 @@ static void method_call_handler (GDBusConnection *connection, gint input; g_variant_get(parameters, "(i)", &input); - printf ("%s:%d\n", method_name, input); + printf("%s:%d\n", method_name, input); - g_dbus_method_invocation_return_value (invocation, g_variant_new("(i)", input)); + g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", input)); } static const GDBusInterfaceVTable vtable = @@ -82,33 +82,33 @@ static int dbus_server() conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (!conn || error) { - fprintf (stderr, "failed to get system bus\n"); + fprintf(stderr, "failed to get system bus\n"); return -1; } - introspection_data = g_dbus_node_info_new_for_xml (xml, NULL); + introspection_data = g_dbus_node_info_new_for_xml(xml, NULL); if (!introspection_data) { - fprintf (stderr, "g_dbus_node_info_new_for_xml fails\n"); + fprintf(stderr, "g_dbus_node_info_new_for_xml fails\n"); return -1; } - registration_id = g_dbus_connection_register_object (conn, PATH, introspection_data->interfaces[0], &vtable, NULL, NULL, NULL); + registration_id = g_dbus_connection_register_object(conn, PATH, introspection_data->interfaces[0], &vtable, NULL, NULL, NULL); if (registration_id == 0) { - fprintf (stderr, "g_dbus_connection_register_object fails\n"); + fprintf(stderr, "g_dbus_connection_register_object fails\n"); return -1; } owner_id = g_bus_own_name_on_connection(conn, "org.tizen.dbus-send-receive-test", G_BUS_NAME_OWNER_FLAGS_NONE, name_acquire, name_lost, NULL, NULL); if (owner_id == 0) { - fprintf (stderr, "g_bus_own_name_on_connection fails\n"); + fprintf(stderr, "g_bus_own_name_on_connection fails\n"); return -1; } mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); - g_bus_unown_name (owner_id); - g_dbus_node_info_unref (introspection_data); + g_bus_unown_name(owner_id); + g_dbus_node_info_unref(introspection_data); g_main_loop_unref(mainloop); return 0; @@ -123,18 +123,19 @@ static int dbus_client() conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (!conn || error) { - fprintf (stderr, "failed to get system bus\n"); + fprintf(stderr, "failed to get system bus\n"); return -1; } reply = g_dbus_connection_call_sync(conn, NAME, PATH, INTERFACE, METHOD, g_variant_new("(i)", 1), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); if (!reply || error) { - fprintf (stderr, "g_dbus_connection_call_sync fails\n"); + fprintf(stderr, "g_dbus_connection_call_sync fails\n"); return -1; } - g_variant_get (reply, "(i)", &result); - printf ("reply %d\n", result); + g_variant_get(reply, "(i)", &result); + g_variant_unref(reply); + printf("reply %d\n", result); return 0; } @@ -143,7 +144,7 @@ int main(int argc, char *argv[]) { if (argc != 2) { - printf ("Usage %s [server|client]\n", argv[0]); + printf("Usage %s [server|client]\n", argv[0]); exit (0); } |