replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / easy-setup / sampleapp / enrollee / linux / easysetup_x.c
index aaa351b..d7a2773 100755 (executable)
@@ -48,18 +48,25 @@ void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata)
 
     if(payload != NULL)
     {
-        if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFI))
+        if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFICONF))
         {
             int64_t value = -1;
             if (OCRepPayloadGetPropInt(payload, USERPROPERTY_KEY_INT, &value))
             {
-                if(*userdata != NULL)
+                if(*userdata == NULL)
                 {
                     *userdata = (void*)OICMalloc(sizeof(UserProperties));
+                    if( *userdata == NULL )
+                    {
+                        OIC_LOG(ERROR, ESX_ENROLLEE_TAG, "OICMalloc for UserProperties is failed");
+                        return ;
+                    }
+                    memset(*userdata, 0, sizeof(UserProperties));
                 }
+
+                ((UserProperties*)(*userdata))->userValue_int = value;
                 OIC_LOG_V(INFO, ESX_ENROLLEE_TAG, "[User specific property] %s : %ld",
                                                                             USERPROPERTY_KEY_INT, value);
-                ((UserProperties*)(*userdata))->userValue_int = value;
                 g_userProperties.userValue_int = value;
             }
         }
@@ -74,7 +81,7 @@ void WriteUserdataCb(OCRepPayload* payload, char* resourceType)
 
     if(payload != NULL)
     {
-        if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFI))
+        if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFICONF))
         {
             OCRepPayloadSetPropInt(payload, USERPROPERTY_KEY_INT, g_userProperties.userValue_int);
         }