[IOT-3295] Test CT2.3.1 fails fix 64/29664/2
authorIurii Metelytsia <i.metelytsia@samsung.com>
Thu, 1 Aug 2019 12:56:31 +0000 (15:56 +0300)
committerIurii Metelytsia <i.metelytsia@samsung.com>
Mon, 5 Aug 2019 09:07:19 +0000 (09:07 +0000)
Reverts ocpayload.c to commit e64d33ff21e91b3d935be7016e57257b86ba0530

Signed-off-by: Iurii Metelytsia <i.metelytsia@samsung.com>
Change-Id: Ib88b999ef911bcfb61bfd32f97900b529af7ccee

resource/csdk/stack/src/ocpayload.c

index 4d4fca5..2d62a7f 100644 (file)
@@ -902,7 +902,10 @@ size_t OC_CALL calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH])
     }
 
     size_t total = 1;
-    for(; total < MAX_REP_ARRAY_DEPTH && dimensions[total] != 0; ++total);
+    for(uint8_t i = 0; i < MAX_REP_ARRAY_DEPTH && dimensions[i] != 0; ++i)
+    {
+        total *= dimensions[i];
+    }
     return total;
 }
 
@@ -1208,7 +1211,7 @@ bool OC_CALL OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name,
         return false;
     }
 
-    char** newArray = (char**)OICCalloc(dimTotal, sizeof(char*));
+    char** newArray = (char**)OICMalloc(dimTotal * sizeof(char*));
 
     if (!newArray)
     {