Do malloc and free in the same level
authorCheoleun Moon <chleun.moon@samsung.com>
Thu, 5 Mar 2020 05:30:11 +0000 (14:30 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Thu, 5 Mar 2020 05:30:11 +0000 (14:30 +0900)
src/wifi-aware-private.c

index f4a39ea..e2a2121 100644 (file)
@@ -1005,6 +1005,11 @@ wifi_aware_message_s *__create_message_data(wifi_aware_session_h session,
        return result;
 }
 
+void __destroy_message_data(wifi_aware_message_s *message)
+{
+       g_free(message);
+}
+
 static void __wifi_aware_followup_invoke_callback(wifi_aware_message_s *message, wifi_aware_error_e error)
 {
        if (message && message->callback)
@@ -1040,7 +1045,7 @@ static void __send_message_reply(GObject *src, GAsyncResult *res, gpointer user_
        }
 
        __wifi_aware_followup_invoke_callback(message, error);
-       g_free(message);
+       __destroy_message_data(message);
 }
 
 int _wifi_aware_send_message(wifi_aware_session_h session,