Merge branch 'master' into tizen_2.1
[apps/native/ug-wifi-direct.git] / popup-wifidirect / src / wfd-app-client.c
index 94803f6..4ef023b 100755 (executable)
@@ -1,9 +1,9 @@
 /*
 *  WiFi-Direct UG
 *
-* Copyright 2012  Samsung Electronics Co., Ltd
+* Copyright 2012 Samsung Electronics Co., Ltd
 
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 
@@ -168,9 +168,9 @@ void _add_wfd_peers_connected_notification(void *user_data)
        res = notification_set_execute_option(ad->noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, /*Button Text*/NULL, NULL, b);
        if (res != NOTIFICATION_ERROR_NONE) {
                WDPOP_LOGD( "Failed to notification_set_execute_option. [%d]", res);
+               bundle_free(b);
                return;
        }
-
        bundle_free(b);
 
        /* set display application list */
@@ -241,9 +241,9 @@ void _add_wfd_turn_off_notification(void *user_data)
        res = notification_set_execute_option(ad->noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, /*Button Text*/NULL, NULL, b);
        if (res != NOTIFICATION_ERROR_NONE) {
                WDPOP_LOGD( "Failed to notification_set_execute_option. [%d]", res);
+               bundle_free(b);
                return;
        }
-
        bundle_free(b);
 
        /* set display application list */
@@ -396,6 +396,7 @@ bool _wfd_app_discoverd_peer_cb(wifi_direct_discovered_peer_info_s *peer, void *
        if (NULL != peer->mac_address) {
                WDPOP_LOGD( "discovered peer mac[%s]\n", peer->mac_address);
                strncpy(ad->discovered_peers[ad->discovered_peer_count].mac_address, peer->mac_address, 18);
+               ad->discovered_peers[ad->discovered_peer_count].mac_address[17] = '\0';
        } else {
                WDPOP_LOGD( "peer's mac is NULL\n");
        }
@@ -567,6 +568,7 @@ void _cb_connection(int error_code, wifi_direct_connection_state_e connection_st
                        }
 
                        strncpy(ad->pin_number, pin, 64);
+                       ad->pin_number[63] = '\0';
                        free(pin);
                        pin = NULL;
 
@@ -800,12 +802,7 @@ int init_wfd_popup_client(wfd_appdata_t *ad)
        }
 
        __WDPOP_LOG_FUNC_EXIT__;
-
-       if (ret == WIFI_DIRECT_ERROR_NONE) {
-               return TRUE;
-       } else {
-               return FALSE;
-       }
+       return TRUE;
 }
 
 /**