Fix memory leak 56/77456/5 accepted/tizen/common/20160703.130554 accepted/tizen/ivi/20160701.033305 accepted/tizen/mobile/20160701.033436 accepted/tizen/tv/20160701.033114 accepted/tizen/wearable/20160701.033150 submit/tizen/20160630.084032 submit/tizen_common/20160701.180000
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 30 Jun 2016 01:29:40 +0000 (10:29 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 30 Jun 2016 08:39:29 +0000 (17:39 +0900)
 - Used '&s' for string that does not need to free instead of 's' for argument of g_variant_get() in mm_sound_mgr_focus_dbus.c
 - Added omitted g_error_free() for err variable in mm_sound_dbus.c

[Version] Release 0.10.39
[Profile] Common
[Issue Type] Memory leak
[JIRA] TSAM-5489

Change-Id: I8d936a5729303f099b0a84d4e5d18899df1c5e7a
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
common/mm_sound_dbus.c
mm_sound_client.c
mm_sound_proxy.c
packaging/libmm-sound.spec
server/mm_sound_mgr_focus_dbus.c
server/mm_sound_mgr_ipc_dbus.c

index 580aac5..3c3350c 100644 (file)
@@ -538,6 +538,7 @@ int mm_sound_dbus_emit_signal(audio_provider_t provider, audio_event_t event, GV
                                                  param, &err);
        if (!dbus_ret) {
                debug_error ("g_dbus_connection_emit_signal() error (%s)", err->message);
+               g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
        }
        g_dbus_connection_flush_sync(conn, NULL, NULL);
index 0169718..da077ec 100644 (file)
@@ -1067,7 +1067,7 @@ static gboolean _focus_callback_handler(gpointer d)
        return TRUE;
 }
 
-static gboolean _focus_watch_callback_handler( gpointer d)
+static gboolean _focus_watch_callback_handler(gpointer d)
 {
        GPollFD *data = (GPollFD*)d;
        int count;
@@ -1118,7 +1118,6 @@ static gboolean _focus_watch_callback_handler( gpointer d)
                }
 
 #ifdef CONFIG_ENABLE_RETCB
-
                        int rett = 0;
                        int tmpfd = -1;
                        int buf = -1;
index cd43eb6..9f58de3 100644 (file)
@@ -36,7 +36,7 @@ struct callback_data {
 static int _notify_subscription(audio_event_t event, uint32_t subs_id, gboolean subscribe)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL;
+       GVariant *params = NULL;
        const char *event_name = NULL;
 
        debug_fenter();
@@ -62,7 +62,7 @@ static int _notify_subscription(audio_event_t event, uint32_t subs_id, gboolean
 static int _notify_signal_handled(audio_event_t event, uint32_t event_id, uint32_t subs_id, GVariant *signal_params)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL;
+       GVariant *params = NULL;
        const char *event_name = NULL;
 
        debug_fenter();
@@ -209,7 +209,7 @@ int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** d
 {
        int ret = MM_ERROR_NONE;
        GVariant *result = NULL, *child = NULL;
-       GVariant *params;
+       GVariant *params = NULL;
        GVariantIter iter;
        mm_sound_device_t* device_item;
        const gchar *device_name_tmp = NULL, *device_type_tmp = NULL;
@@ -408,7 +408,7 @@ int mm_sound_proxy_play_tone(int tone, int repeat, int volume, int volume_config
 {
        int ret = MM_ERROR_NONE;
        int handle = 0;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
        gboolean _enable_session = enable_session;
 
        if (!codechandle) {
@@ -451,7 +451,7 @@ int mm_sound_proxy_play_tone_with_stream_info(int client_pid, int tone, char *st
 {
        int ret = MM_ERROR_NONE;
        int handle = 0;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        debug_fenter();
 
@@ -494,7 +494,7 @@ int mm_sound_proxy_play_sound(const char* filename, int tone, int repeat, int vo
 {
        int ret = MM_ERROR_NONE;
        int handle = 0;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
        gboolean _enable_session = enable_session;
 
        if (!filename || !codechandle) {
@@ -536,7 +536,7 @@ int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat,
 {
        int ret = MM_ERROR_NONE;
        int handle = 0;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        if (!filename || !codechandle) {
                debug_error("Param for play is null");
@@ -648,7 +648,7 @@ int mm_sound_proxy_remove_play_sound_end_callback(unsigned subs_id)
 int mm_sound_proxy_emergent_exit(int exit_pid)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL;
+       GVariant *params = NULL;
 
        debug_fenter();
 
@@ -711,7 +711,7 @@ static GVariant* _get_cookie_variant ()
        for (i = 0; i < COOKIE_SIZE; i++)
                g_variant_builder_add(&builder, "y", cookie[i]);
 
-       free (cookie);
+       free(cookie);
        return g_variant_builder_end(&builder);
 }
 
@@ -745,7 +745,7 @@ int mm_sound_proxy_get_unique_id(int *id)
 int mm_sound_proxy_register_focus(int id, int instance, const char *stream_type, mm_sound_focus_changed_cb callback, bool is_for_session, void* userdata)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 #ifdef SUPPORT_CONTAINER
        char container[128];
 #endif
@@ -788,7 +788,7 @@ int mm_sound_proxy_register_focus(int id, int instance, const char *stream_type,
 int mm_sound_proxy_unregister_focus(int instance, int id, bool is_for_session)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        debug_fenter();
 
@@ -814,7 +814,7 @@ int mm_sound_proxy_unregister_focus(int instance, int id, bool is_for_session)
 int mm_sound_proxy_set_foucs_reacquisition(int instance, int id, bool reacquisition)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        debug_fenter();
 
@@ -839,7 +839,7 @@ int mm_sound_proxy_set_foucs_reacquisition(int instance, int id, bool reacquisit
 int mm_sound_proxy_get_acquired_focus_stream_type(int focus_type, char **stream_type, char **additional_info)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        debug_fenter();
 
@@ -864,7 +864,7 @@ int mm_sound_proxy_get_acquired_focus_stream_type(int focus_type, char **stream_
 int mm_sound_proxy_acquire_focus(int instance, int id, mm_sound_focus_type_e type, const char *option, bool is_for_session)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        debug_fenter();
 
@@ -889,7 +889,7 @@ int mm_sound_proxy_acquire_focus(int instance, int id, mm_sound_focus_type_e typ
 int mm_sound_proxy_release_focus(int instance, int id, mm_sound_focus_type_e type, const char *option, bool is_for_session)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        debug_fenter();
 
@@ -914,7 +914,7 @@ int mm_sound_proxy_release_focus(int instance, int id, mm_sound_focus_type_e typ
 int mm_sound_proxy_set_focus_watch_callback(int instance, int handle, mm_sound_focus_type_e type, mm_sound_focus_changed_watch_cb callback, bool is_for_session, void* userdata)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 #ifdef SUPPORT_CONTAINER
        char container[128];
 #endif
@@ -954,7 +954,7 @@ int mm_sound_proxy_set_focus_watch_callback(int instance, int handle, mm_sound_f
 int mm_sound_proxy_unset_focus_watch_callback(int focus_tid, int handle, bool is_for_session)
 {
        int ret = MM_ERROR_NONE;
-       GVariantparams = NULL, *result = NULL;
+       GVariant *params = NULL, *result = NULL;
 
        debug_fenter();
 
index f881d58..7375835 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.10.38
+Version:    0.10.39
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 7a4777c..12ce404 100644 (file)
@@ -304,19 +304,19 @@ static void handle_method_register_focus(GDBusMethodInvocation* invocation)
 
 #ifdef SUPPORT_CONTAINER
 #ifdef USE_SECURITY
-       g_variant_get(params, "(@ayiisb)", &cookie_data, &container_pid, &handle_id, &stream_type, &is_for_session);
+       g_variant_get(params, "(@ayii&sb)", &cookie_data, &container_pid, &handle_id, &stream_type, &is_for_session);
        container = _get_container_from_cookie(cookie_data);
        ret = __mm_sound_mgr_focus_ipc_register_focus(_get_sender_pid(invocation), handle_id, stream_type, is_for_session, container, container_pid);
 
        if (container)
                free(container);
 #else /* USE_SECURITY */
-       g_variant_get(params, "(siisb)", &container, &container_pid, &handle_id, &stream_type, &is_for_session);
+       g_variant_get(params, "(&sii&sb)", &container, &container_pid, &handle_id, &stream_type, &is_for_session);
        ret = __mm_sound_mgr_focus_ipc_register_focus(_get_sender_pid(invocation), handle_id, stream_type, is_for_session, container, container_pid);
 
 #endif /* USE_SECURITY */
 #else /* SUPPORT_CONTAINER */
-       g_variant_get(params, "(iisb)", &pid, &handle_id, &stream_type, &is_for_session);
+       g_variant_get(params, "(ii&sb)", &pid, &handle_id, &stream_type, &is_for_session);
        ret = __mm_sound_mgr_focus_ipc_register_focus(_get_sender_pid(invocation), handle_id, stream_type, is_for_session);
 
 #endif /* SUPPORT_CONTAINER */
@@ -507,7 +507,7 @@ static void handle_method_watch_focus(GDBusMethodInvocation* invocation)
        if (container)
                free(container);
 #else /* USE_SECURITY */
-       g_variant_get(params, "(siiib)", &container, &container_pid, &handle_id, &focus_type, &is_for_session);
+       g_variant_get(params, "(&siiib)", &container, &container_pid, &handle_id, &focus_type, &is_for_session);
        ret = __mm_sound_mgr_focus_ipc_watch_focus(_get_sender_pid(invocation), handle_id, focus_type, is_for_session, container, container_pid);
 
 #endif /* USE_SECURITY */
@@ -760,7 +760,7 @@ int MMSoundMgrFocusDbusInit(void)
 {
        debug_enter();
 
-       introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
+       introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, NULL);
        if (!introspection_data)
                return MM_ERROR_SOUND_INTERNAL;
 
index 6b812d0..d48aff7 100644 (file)
@@ -269,7 +269,7 @@ static void handle_method_test(GDBusMethodInvocation* invocation)
 {
        int ret = MM_ERROR_NONE;
        int val = 0, val2 = 0;
-       GVariantparams = NULL;
+       GVariant *params = NULL;
 
        debug_fenter();