fix memory leak issue 75/121875/1
authorKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 29 Mar 2017 08:47:26 +0000 (17:47 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 29 Mar 2017 08:47:26 +0000 (17:47 +0900)
Change-Id: I6fe4646dc8492372a947bff95989ef7fd15bd678
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
manager/src/msg-manager.cpp

index 10d75d2..8f2fba8 100644 (file)
@@ -153,6 +153,9 @@ void _incoming_msg_func(app_control_h app_control)
        contactInfo contact_info = {0, };
        contact_info.msgId = msg_id;
 
+       g_free(rcv_msg_id);
+       g_free(rcv_msg_type);
+
        msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
        opt = msg_create_struct(MSG_STRUCT_SENDOPT);
        msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
@@ -180,9 +183,6 @@ void _incoming_msg_func(app_control_h app_control)
        msg_release_struct(&msg);
        msg_release_struct(&opt);
 
-       g_free(rcv_msg_id);
-       g_free(rcv_msg_type);
-
        MSG_MGR_END();
 }
 
@@ -216,6 +216,9 @@ void _outgoing_msg_func(app_control_h app_control)
        contactInfo contact_info = {0, };
        contact_info.msgId = msg_id;
 
+       g_free(sent_msg_id);
+       g_free(sent_msg_type);
+
        msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
        opt = msg_create_struct(MSG_STRUCT_SENDOPT);
        msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
@@ -241,9 +244,6 @@ void _outgoing_msg_func(app_control_h app_control)
        msg_release_struct(&msg);
        msg_release_struct(&opt);
 
-       g_free(sent_msg_id);
-       g_free(sent_msg_type);
-
        MSG_MGR_END();
 }
 
@@ -337,6 +337,8 @@ void _add_noti_func(app_control_h app_control)
        MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
        msg_info.msgId = msg_id;
 
+       g_free(msgId);
+
        msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
        opt = msg_create_struct(MSG_STRUCT_SENDOPT);
        msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
@@ -366,8 +368,6 @@ void _add_noti_func(app_control_h app_control)
        msg_release_struct(&msg);
        msg_release_struct(&opt);
 
-       g_free(msgId);
-
        MsgMgrAddNotification(noti_type, &msg_info);
 }
 
@@ -446,6 +446,8 @@ void _add_report_noti_func(app_control_h app_control)
        MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
        msg_info.msgId = msg_id;
 
+       g_free(msgId);
+
        msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
        opt = msg_create_struct(MSG_STRUCT_SENDOPT);
        msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
@@ -468,8 +470,6 @@ void _add_report_noti_func(app_control_h app_control)
        msg_release_struct(&msg);
        msg_release_struct(&opt);
 
-       g_free(msgId);
-
        MsgMgrAddReportNotification(noti_type, &msg_info);
 }
 
@@ -526,6 +526,8 @@ void _insert_only_active_noti_func(app_control_h app_control)
        MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
        msg_info.msgId = msg_id;
 
+       g_free(msgId);
+
        msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
        opt = msg_create_struct(MSG_STRUCT_SENDOPT);
        msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
@@ -554,8 +556,6 @@ void _insert_only_active_noti_func(app_control_h app_control)
        msg_release_struct(&msg);
        msg_release_struct(&opt);
 
-       g_free(msgId);
-
        MsgMgrInsertOnlyActiveNotification(noti_type, &msg_info);
 }