Bug Fix - the Object Array Value in the Palyload was not cloned properly.
authorJay Oh <junghyun.oh@samsung.com>
Fri, 1 Apr 2016 02:36:30 +0000 (11:36 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 5 Apr 2016 10:45:52 +0000 (10:45 +0000)
- Object type (String) value was not checked
- Modification : add the case handling for OCREP_PROP_OBJECT

Change-Id: I8fe9c1fc7fec43648d2127284169af225a6a2bb0
Signed-off-by: Jay Oh <junghyun.oh@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7475
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
(cherry picked from commit c53351f54d4e619dcdef8e703c586e2fcea65c9e)
Reviewed-on: https://gerrit.iotivity.org/gerrit/7555
Reviewed-by: Uze Choi <uzchoi@samsung.com>
resource/csdk/stack/src/ocpayload.c

index 67b70e812ff16189342c8d6e60d5669f9204c2b9..688ec5dd2cb94aa65227d50bd1c97b14205d0873 100755 (executable)
@@ -148,6 +148,13 @@ static void OCCopyPropertyValueArray(OCRepPayloadValue* dest, OCRepPayloadValue*
                 dest->arr.strArray[i] = OICStrdup(source->arr.strArray[i]);
             }
             break;
+        case OCREP_PROP_OBJECT:
+            dest->arr.objArray = (OCRepPayload**)OICMalloc(dimTotal * sizeof(OCRepPayload*));
+            for(size_t i = 0; i < dimTotal; ++i)
+            {
+                dest->arr.objArray[i] = OCRepPayloadClone(source->arr.objArray[i]);
+            }
+            break;
         case OCREP_PROP_ARRAY:
             dest->arr.objArray = (OCRepPayload**)OICMalloc(dimTotal * sizeof(OCRepPayload*));
             for(size_t i = 0; i < dimTotal; ++i)
@@ -230,7 +237,7 @@ static void OCFreeRepPayloadValueContents(OCRepPayloadValue* val)
                 }
                 OICFree(val->arr.ocByteStrArray);
                 break;
-            case OCREP_PROP_OBJECT:
+            case OCREP_PROP_OBJECT: // This case is the temporary fix for string input
                 for(size_t i = 0; i< dimTotal; ++i)
                 {
                     OCRepPayloadDestroy(val->arr.objArray[i]);