[IOT-1550] Resolved reset issue on rowner of cred
[platform/upstream/iotivity.git] / resource / provisioning / examples / cloudClient.cpp
index 317539a..4bf0cca 100644 (file)
@@ -229,11 +229,11 @@ static int saveTrustCert(void)
         size_t fsize;
         if (fseeko(fp, 0, SEEK_END) == 0 && (fsize = ftello(fp)) > 0)
         {
-            trustCertChainArray.data = (uint8_t*)OICCalloc(1, fsize+1);
-            trustCertChainArray.len = fsize+1;
+            trustCertChainArray.data = (uint8_t*)OICCalloc(1, fsize);
+            trustCertChainArray.len = fsize;
             if (NULL == trustCertChainArray.data)
             {
-                OIC_LOG(ERROR,TAG,"OICCalloc");
+                OIC_LOG(ERROR,TAG,"Failed to allocate memory");
                 fclose(fp);
                 return res;
             }
@@ -289,7 +289,7 @@ static void userRequests(void *data)
 
         int request = 0;
         scanf("%d", &request);
-        getchar();
+        for( ; 0x20<=getchar(); );
 
         switch (request)
         {