Fix to add variable value content before calling apis 36/178736/1 accepted/tizen/unified/20180512.130243 submit/tizen/20180511.142441
authorSaulo Moraes <s.moraes@samsung.com>
Fri, 11 May 2018 14:11:16 +0000 (11:11 -0300)
committerSaulo Aldighieri Moraes <s.moraes@samsung.com>
Fri, 11 May 2018 14:11:16 +0000 (11:11 -0300)
Change-Id: I895551f7b09c8cde07ec41294fdef3453869942b

packaging/privacy-guard.spec
server/src/service/DlpPrivacyInfoData.cpp

index 283aac1..c28e83e 100644 (file)
@@ -1,5 +1,5 @@
 Name:           privacy-guard-server
-Version:        0.9.8
+Version:        0.9.9
 Release:        1
 License:        Apache-2.0
 Summary:        Privacy Management
index b3c3769..a7c794d 100644 (file)
@@ -106,7 +106,7 @@ DlpPrivacyInfoData::networkAddressChanged(const char *ipv4, const char *ipv6, vo
 {
        DlpPrivacyInfoData *pid = (DlpPrivacyInfoData*)user_data;
 
-       if (pid != NULL) {
+       if (pid != NULL && ipv4) {
                pid->m_infoMutex.lock();
 
                pid->m_ipv4 = ipv4;
@@ -164,7 +164,7 @@ DlpPrivacyInfoData::positionUpdated(double latitude, double longitude, double al
 
 {
        DlpPrivacyInfoData *pid = (DlpPrivacyInfoData*) user_data;
-       char location[LEN_LOCATION];
+       char location[LEN_LOCATION] = { 0 };
        double lat_round;
        double long_round;
 
@@ -239,7 +239,7 @@ DlpPrivacyInfoData::loadMyProfile(void)
                ret = contacts_record_get_str_p(record,
                                                _contacts_my_profile.display_name,
                                                &value);
-               if (ret == CONTACTS_ERROR_NONE)
+               if (ret == CONTACTS_ERROR_NONE && value)
                        m_owner_name = value;
 
                // Owner: read all phone numbers
@@ -262,7 +262,8 @@ DlpPrivacyInfoData::loadMyProfile(void)
                        if (ret != CONTACTS_ERROR_NONE)
                                continue;
 
-                       m_owner_phoneno_list.insert(value);
+                       if (value && strlen(value))
+                               m_owner_phoneno_list.insert(value);
                }
 
                // Owner: birthday
@@ -319,7 +320,8 @@ DlpPrivacyInfoData::loadMyProfile(void)
                        if (ret != CONTACTS_ERROR_NONE)
                                continue;
 
-                       m_owner_email_list.insert(value);
+                       if (value && strlen(value))
+                               m_owner_email_list.insert(value);
                }
 
                // Owner: read all address
@@ -349,7 +351,7 @@ DlpPrivacyInfoData::loadMyProfile(void)
                        if (ret != CONTACTS_ERROR_NONE)
                                continue;
 
-                       if (value)
+                       if (value && strlen(value))
                                m_owner_address_list.insert(value);
                }
        }
@@ -385,7 +387,7 @@ DlpPrivacyInfoData::loadInfo(const int userId)
 
        if (m_connection && m_ipv4.empty()) {
                int ret_connection = connection_get_ip_address(m_connection, CONNECTION_ADDRESS_FAMILY_IPV4, &ipv4);
-               if (CONNECTION_ERROR_NONE == ret_connection) {
+               if (CONNECTION_ERROR_NONE == ret_connection && ipv4) {
                        m_ipv4 = ipv4;
                        free(ipv4);
                }