diff options
author | Jiyong Min <jiyong.min@samsung.com> | 2017-04-11 10:38:15 +0900 |
---|---|---|
committer | hj kim <backto.kim@samsung.com> | 2017-04-10 19:04:27 -0700 |
commit | 4d82acd6597238a8c9e5434f5d1bf80322bf698e (patch) | |
tree | 693a9b113739325a4edc4123e0aec86a36890f9d | |
parent | 13165a0a4fb202c6a5454299ba992ff1327e0e31 (diff) | |
download | media-controller-4d82acd6597238a8c9e5434f5d1bf80322bf698e.tar.gz media-controller-4d82acd6597238a8c9e5434f5d1bf80322bf698e.tar.bz2 media-controller-4d82acd6597238a8c9e5434f5d1bf80322bf698e.zip |
Remove g-variant_get duplicated and so on the dbus signal
[Problem] During C# TCT, IPC signal make crash by abnormal memory access.
Change-Id: I4f183aed57c661d2988ffe0d8ac15c73bd4846fb
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
-rwxr-xr-x | src/media_controller_ipc.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/media_controller_ipc.c b/src/media_controller_ipc.c index e34bb29..bc621eb 100755 --- a/src/media_controller_ipc.c +++ b/src/media_controller_ipc.c @@ -48,20 +48,23 @@ static void __mc_ipc_signal_cb(GDBusConnection *connection, { char *key = __make_key_for_map(interface_name, signal_name); GList *listener_list = (GList *)user_data; + mc_ipc_listener_s *listener = NULL; unsigned int i = 0; - mc_debug("__mc_ipc_signal_cb Received : "); + mc_debug("__mc_ipc_signal_cb Received :"); - for (i = 0; i < g_list_length(listener_list); i++) { - mc_ipc_listener_s *listener = (mc_ipc_listener_s *)g_list_nth_data(listener_list, i); + gchar *message = NULL; + int internal_flags = 0; + g_variant_get(parameters, "(i&s)", &internal_flags, &message); + if (!message) { + mc_error("g_variant_get() fail"); + return; + } + + unsigned int listener_cnt = g_list_length(listener_list); + for (i = 0; i < listener_cnt; i++) { + listener = (mc_ipc_listener_s *)g_list_nth_data(listener_list, i); if (listener && !strcmp(listener->key, key)) { - gchar *message = NULL; - int internal_flags = 0; - g_variant_get(parameters, "(i&s)", &internal_flags, &message); - if (!message) { - mc_error("g_variant_get() fail"); - break; - } mc_debug("Received : [%s] (flags = %x) from %s.%s", message, internal_flags, listener->interface_name, listener->signal_name); listener->callback(listener->interface_name, listener->signal_name, message, 0, listener->user_data); } |