Fix a svace issue 76/87876/1 accepted/tizen/common/20160912.181442 accepted/tizen/ivi/20160913.041812 accepted/tizen/mobile/20160913.041718 accepted/tizen/tv/20160913.041730 accepted/tizen/wearable/20160913.041752 submit/tizen/20160912.033649 submit/tizen/20160912.055637
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 12 Sep 2016 03:44:35 +0000 (12:44 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 12 Sep 2016 03:44:35 +0000 (12:44 +0900)
Change-Id: I452f73e3f86605c8b2b7eedc75edeac57e633fd5
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-share/src/bt-share-main.c

index 57e14cb..1a43424 100644 (file)
@@ -264,13 +264,14 @@ void __bt_create_transfer_db(void)
 int main(void)
 {
        int ret;
-       struct bt_appdata ad;
        INFO("Starting bluetooth-share daemon");
-       memset(&ad, 0, sizeof(struct bt_appdata));
-       app_state = &ad;
 
        signal(SIGTERM, __bt_sigterm_handler);
 
+       app_state = calloc(1, sizeof(struct bt_appdata));
+       if (!app_state)
+               return -1;
+
 #if 0
        __bt_create_transfer_db();
 #endif
@@ -314,15 +315,15 @@ int main(void)
        }
 
        _bt_init_dbus_signal();
-       _bt_init_vconf_notification(&ad);
+       _bt_init_vconf_notification((void *)app_state);
        __bt_update_transfer_status_values();
-       _bt_register_notification_cb(&ad);
+       _bt_register_notification_cb(app_state);
 
        if (_bt_init_obex_server() == BT_SHARE_ERROR_NONE)
-               ad.obex_server_init = TRUE;
+               app_state->obex_server_init = TRUE;
 
        if (terminated == TRUE) {
-               __bt_release_service(&ad);
+               __bt_release_service(app_state);
                bluetooth_unregister_callback();
                return -1;
        }
@@ -330,7 +331,7 @@ int main(void)
        main_loop = g_main_loop_new(NULL, FALSE);
        g_main_loop_run(main_loop);
 
-       __bt_release_service(&ad);
+       __bt_release_service(app_state);
        bluetooth_unregister_callback();
 
        return 0;