Fix resource leaks when setting locale 50/215650/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix accepted/tizen_unified tizen tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.022437 accepted/tizen/5.5/unified/mobile/hotfix/20201027.090304 accepted/tizen/5.5/unified/wearable/hotfix/20201027.112951 accepted/tizen/unified/20191015.011942 submit/tizen/20191014.062557 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 submit/tizen_5.5_wearable_hotfix/20201026.184304 tizen_5.5.m2_release
authorYoungman <yman.jung@samsung.com>
Mon, 14 Oct 2019 02:31:36 +0000 (11:31 +0900)
committerYoungman <yman.jung@samsung.com>
Mon, 14 Oct 2019 02:34:12 +0000 (11:34 +0900)
Change-Id: Iaceca961e7f15aaa1a9936070ccff9eb3ff02439

server/src/service/DlpPrivacyInfoData.cpp

index ef96005..fce7602 100644 (file)
@@ -46,7 +46,9 @@ DlpPrivacyInfoData *DlpPrivacyInfoData::m_pInstance = NULL;
 
 DlpPrivacyInfoData::DlpPrivacyInfoData() : m_connection(NULL), m_locmgr(NULL), m_myprofile_watch(false)
 {
-       wifi_manager_initialize(&m_wifi_manager);
+       int ret = wifi_manager_initialize(&m_wifi_manager);
+       if (ret < 0)
+               PG_LOGE("wifi_manager_initialize() failed. Error=%d", ret);
 
        m_last_latitude = 0;
        m_last_longitude = 0;
@@ -574,13 +576,16 @@ void
 DlpPrivacyInfoData::localeChanged(keynode_t *key, void *user_data)
 {
        DlpPrivacyInfoData *pid = (DlpPrivacyInfoData *) user_data;
-       const char *locale;
+       char *locale;
        char buffer[18];
 
        // Setting program's locale based on system settings
        locale = vconf_get_str(VCONFKEY_LANGSET);
-       if (locale)
+       if (locale) {
                setlocale(LC_ALL, locale);
+               free(locale);
+               locale = NULL;
+       }
 
        if (pid->m_owner_ibirthday == 0)
                return;
@@ -603,12 +608,15 @@ DlpPrivacyInfoData::start(void)
 {
        pthread_t locmgr_thread;
        int ret;
-       const char *locale;
+       char *locale;
 
        // Setting program's locale based on system settings
        locale = vconf_get_str(VCONFKEY_LANGSET);
-       if (locale)
+       if (locale) {
                setlocale(LC_ALL, locale);
+               free(locale);
+               locale = NULL;
+       }
 
        vconf_notify_key_changed(VCONFKEY_LANGSET, localeChanged, this);