Rename macro VERIFY_CBOR_SUCCESS 63/22563/2
authorSteven Saunders <s.saunders-contractor@cablelabs.com>
Thu, 21 Sep 2017 23:43:32 +0000 (17:43 -0600)
committerNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Wed, 27 Sep 2017 16:34:07 +0000 (16:34 +0000)
to VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY

Change-Id: I5ee8795a21d8d84708737f83957fe260cf1234d2
Signed-off-by: Steven Saunders <s.saunders-contractor@cablelabs.com>
14 files changed:
bridging/common/messageHandler.cpp
resource/csdk/security/src/aclresource.c
resource/csdk/security/src/amaclresource.c
resource/csdk/security/src/credresource.c
resource/csdk/security/src/crlresource.c
resource/csdk/security/src/csrresource.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/psinterface.c
resource/csdk/security/src/pstatresource.c
resource/csdk/security/src/rolesresource.c
resource/csdk/security/tool/json2cbor.c
resource/csdk/stack/include/ocpayload.h
resource/csdk/stack/src/ocpayloadconvert.c
resource/csdk/stack/src/ocpayloadparse.c

index acf0811..904e8c6 100644 (file)
@@ -44,7 +44,7 @@
 #define PLUGINSPECIFICDETAILS   "PluginSpecificDetails"
 #define RESOURCES               "RESOURCES"
 
-#define VERIFY_CBOR_SUCCESS(log_tag, err, log_message) \
+#define VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(log_tag, err, log_message) \
     if ((CborNoError != (err)) && (CborErrorOutOfMemory != (err))) \
     { \
         if ((log_tag) && (log_message)) \
@@ -134,38 +134,38 @@ int64_t MPMFormMetaData(MPMResourceList *list, MPMDeviceSpecificData *deviceDeta
     cbor_encoder_init(&encoder, buff, size, 0);
 
     err = cbor_encoder_create_array(&encoder, &rootArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, " Creating Root Array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Creating Root Array");
 
     err = cbor_encoder_create_map(&rootArray, &rootMap, CborIndefiniteLength);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Creating Root MAP");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Creating Root MAP");
 
     if (deviceDetails)
     {
         err = AddTextStringToMap(&rootMap, NAME, sizeof(NAME) - 1,
                                  deviceDetails->devName);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Adding device name");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Adding device name");
 
         err = AddTextStringToMap(&rootMap, MANUFACTURER, sizeof(MANUFACTURER) - 1,
                                  deviceDetails->manufacturerName);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Adding Manufacture name");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Adding Manufacture name");
 
         err = AddTextStringToMap(&rootMap, DEVICETYPE, sizeof(DEVICETYPE) - 1,
                                  deviceDetails->devType);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Adding Device Type");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Adding Device Type");
     }
 
     if (details)
     {
         err = AddstructureToMap(&rootMap, PLUGINSPECIFICDETAILS, sizeof(PLUGINSPECIFICDETAILS) - 1,
                                 (const char *)details, payloadSize);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Adding Plugin specific Details");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Adding Plugin specific Details");
     }
 
     err = cbor_encode_text_string(&rootMap, RESOURCES, sizeof(RESOURCES) - 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Encoding Resources string");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Encoding Resources string");
 
     err = cbor_encoder_create_array(&rootMap, &linkArray, CborIndefiniteLength);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Creating Link Array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Creating Link Array");
 
     for ( ; list ; )
     {
@@ -174,30 +174,30 @@ int64_t MPMFormMetaData(MPMResourceList *list, MPMDeviceSpecificData *deviceDeta
                   list->interfaces, list->bitmap);
         // resource map inside the links array.
         err = cbor_encoder_create_map(&linkArray, &linkMap, 4);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Creating Link Map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Creating Link Map");
 
         err = AddTextStringToMap(&linkMap, OC::Key::RESOURCETYPESKEY.c_str(),
                                  OC::Key::RESOURCETYPESKEY.size(),
                                  list->rt);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Adding Resource type");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Adding Resource type");
 
         err = AddTextStringToMap(&linkMap, OC::Key::URIKEY.c_str(), OC::Key::URIKEY.size(),
                                  list->href);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Adding OC::Key::URIKEY");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Adding OC::Key::URIKEY");
 
         err = AddTextStringToMap(&linkMap, OC::Key::INTERFACESKEY.c_str(),
                                  OC::Key::INTERFACESKEY.size(), list->interfaces);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Adding Resource Interface");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Adding Resource Interface");
 
         err = cbor_encode_text_string(&linkMap, OC::Key::BMKEY.c_str(), OC::Key::BMKEY.size());
-        VERIFY_CBOR_SUCCESS(TAG, err, "Encoding Bitmap string");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Encoding Bitmap string");
 
         err = cbor_encode_int(&linkMap, list->bitmap);
-        VERIFY_CBOR_SUCCESS(TAG, err, "encoding bit map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "encoding bit map");
 
         // close link map inside link array
         err = cbor_encoder_close_container(&linkArray, &linkMap);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Closing link map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Closing link map");
 
         list = list -> next;
         OICFree(temp);
@@ -205,15 +205,15 @@ int64_t MPMFormMetaData(MPMResourceList *list, MPMDeviceSpecificData *deviceDeta
 
     // Close links array inside the root map.
     err = cbor_encoder_close_container(&rootMap, &linkArray);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Closing link array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Closing link array");
 
     // close root map inside the root array.
     err = cbor_encoder_close_container(&rootArray, &rootMap);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Closing Root Map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Closing Root Map");
 
     // Close the final root array.
     err = cbor_encoder_close_container(&encoder, &rootArray);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Closing root Array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Closing root Array");
 
     return err;
 }
@@ -229,13 +229,13 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
     int bitmap;
 
     err = cbor_parser_init(buff, size, 0, &parser, &rootValue);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Parser cbor init");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Parser cbor init");
 
     if (cbor_value_is_array(&rootValue))
     {
         OIC_LOG_V(DEBUG, TAG, "ENCODED DATA - %s ", (char *)buff);
         err = cbor_value_enter_container(&rootValue, &rootMapValue);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Entering root array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Entering root array");
         if (!cbor_value_is_map(&rootMapValue))
         {
             OIC_LOG(ERROR, TAG, "ERROR, Malformed packet");
@@ -246,7 +246,7 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
         {
             // Parsing device details
             err = cbor_value_map_find_value(&rootMapValue, NAME, &curVal);
-            VERIFY_CBOR_SUCCESS(TAG, err, "finding Name in map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "finding Name in map");
             if (cbor_value_is_valid(&curVal))
             {
                 if (cbor_value_is_text_string(&curVal))
@@ -254,7 +254,7 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
                     size_t len = 0;
                     char *input = NULL;
                     err = cbor_value_dup_text_string(&curVal, &input, &len, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Duplicating name string");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Duplicating name string");
                     OIC_LOG_V(DEBUG, TAG, "\"NAME\":%s\n", input);
                     free(input);
                 }
@@ -262,7 +262,7 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
         }
 
         err = cbor_value_map_find_value(&rootMapValue, MANUFACTURER, &curVal);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Finding Manufacturer details in map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Finding Manufacturer details in map");
         if (cbor_value_is_valid(&curVal))
         {
             if (cbor_value_is_text_string(&curVal))
@@ -270,14 +270,14 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
                 size_t len = 0;
                 char *input = NULL;
                 err = cbor_value_dup_text_string(&curVal, &input, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Copying Text string");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Copying Text string");
                 OIC_LOG_V(DEBUG, TAG, "\"MF\":%s\n", input);
                 free(input);
             }
         }
 
         err = cbor_value_map_find_value(&rootMapValue, PLUGINSPECIFICDETAILS, &curVal);
-        VERIFY_CBOR_SUCCESS(TAG, err, " Finding PLUGINSPECIFICDETAILS in map ");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Finding PLUGINSPECIFICDETAILS in map ");
         if (cbor_value_is_valid(&curVal))
         {
             if (cbor_value_is_text_string(&curVal))
@@ -285,20 +285,20 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
                 size_t len = 0;
                 char *input = NULL;
                 err = cbor_value_dup_text_string(&curVal, &input, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Copying Text string");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Copying Text string");
                 *details = (void *)input;
             }
         }
 
         err = cbor_value_map_find_value(&rootMapValue, RESOURCES, &linkMapValue);
-        VERIFY_CBOR_SUCCESS(TAG, err, " Finding RESOURCES in map ");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Finding RESOURCES in map ");
         // Enter the links array and start iterating through the array processing
         // each resource which shows up as a map.
         if (cbor_value_is_valid(&linkMapValue))
         {
 
             err = cbor_value_enter_container(&linkMapValue, &resourceMapValue);
-            VERIFY_CBOR_SUCCESS(TAG, err, " Entering Link map ");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Entering Link map ");
             while (cbor_value_is_map(&resourceMapValue))
             {
                 MPMResourceList *tempPtr;
@@ -311,39 +311,39 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
                 size_t len = 0;
                 char *input = NULL;
                 err = cbor_value_map_find_value(&resourceMapValue, OC::Key::URIKEY.c_str(), &curVal);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Finding Uri in map ");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Finding Uri in map ");
 
                 err = cbor_value_dup_text_string(&curVal, &input, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Copying Text string");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Copying Text string");
                 strncpy(tempPtr->href, input, MPM_MAX_LENGTH_64);
                 OIC_LOG_V(DEBUG, TAG, "\"ref\":%s\n", input);
                 free(input);
                 input = NULL;
 
                 err = cbor_value_map_find_value(&resourceMapValue, OC::Key::RESOURCETYPESKEY.c_str(), &curVal);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Finding Rt in link map ");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Finding Rt in link map ");
                 err = cbor_value_dup_text_string(&curVal, &input, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Copying Text string");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Copying Text string");
                 strncpy(tempPtr->rt, input, MPM_MAX_LENGTH_64);
                 OIC_LOG_V(DEBUG, TAG, "\"rt\":%s\n", input);
                 free(input);
                 input = NULL;
 
                 err = cbor_value_map_find_value(&resourceMapValue, OC::Key::INTERFACESKEY.c_str(), &curVal);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Finding If's in link map ");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Finding If's in link map ");
                 err = cbor_value_dup_text_string(&curVal, &input, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Copying Text string");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Copying Text string");
                 strncpy(tempPtr->interfaces, input, MPM_MAX_LENGTH_64);
                 OIC_LOG_V(DEBUG, TAG, "\"if\":%s\n", input);
                 free(input);
                 input = NULL;
 
                 err = cbor_value_map_find_value(&resourceMapValue, OC::Key::BMKEY.c_str(), &curVal);
-                VERIFY_CBOR_SUCCESS(TAG, err, " Finding Bms in link map ");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Finding Bms in link map ");
                 if (cbor_value_is_integer(&curVal))
                 {
                     err = cbor_value_get_int(&curVal, &bitmap);
-                    VERIFY_CBOR_SUCCESS(TAG, err, " Getting bit map value fromx link map ");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, " Getting bit map value fromx link map ");
                     tempPtr->bitmap = bitmap;
                     OIC_LOG_V(DEBUG, TAG, "\"bm\":%d\n", bitmap);
                 }
@@ -351,7 +351,7 @@ void MPMParseMetaData(const uint8_t *buff, size_t size, MPMResourceList **list,
                 tempPtr->next = *list;
                 *list  = tempPtr;
                 err = cbor_value_advance(&resourceMapValue);
-                VERIFY_CBOR_SUCCESS(TAG, err, "in resource map value advance");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "in resource map value advance");
             }
         }
     }
index 58c1089..1d903a4 100644 (file)
@@ -413,7 +413,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
 
     // Create ACL Map which contains aclist or aclist2, rowneruuid, rt and if
     cborEncoderResult = cbor_encoder_create_map(&encoder, &aclMap, ACL_MAP_SIZE);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating ACL Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Creating ACL Map.");
     OIC_LOG_V(DEBUG, TAG, "%s starting encoding of %s resource.",
         __func__, (OIC_SEC_ACL_V1 == aclVersion)?"v1 acl":"v2 acl2");
 
@@ -422,7 +422,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
     {
         cborEncoderResult = cbor_encode_text_string(&aclMap, OIC_JSON_ACLIST_NAME,
             strlen(OIC_JSON_ACLIST_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding aclist Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding aclist Tag.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1 %s tag.", __func__, OIC_JSON_ACLIST_NAME);
     }
     // v2 uses "aclist2" as the top-level tag, containing an array of ace2 objects
@@ -430,7 +430,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
     {
         cborEncoderResult = cbor_encode_text_string(&aclMap, OIC_JSON_ACLIST2_NAME,
             strlen(OIC_JSON_ACLIST2_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding aclist2 Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding aclist2 Tag.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_ACLIST2_NAME);
     }
 
@@ -438,13 +438,13 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
     if (OIC_SEC_ACL_V1 == aclVersion)
     {
         cborEncoderResult = cbor_encoder_create_map(&aclMap, &aclListMap, ACL_ACLIST_MAP_SIZE);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating aclist Map.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Creating aclist Map.");
         OIC_LOG_V(DEBUG, TAG, "%s created v1 %s map.", __func__, OIC_JSON_ACLIST_NAME);
 
         // v1 precedes ACE object array with "ace" tag
         cborEncoderResult = cbor_encode_text_string(&aclListMap, OIC_JSON_ACES_NAME,
             strlen(OIC_JSON_ACES_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACES Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACES Name Tag.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1 %s tag.", __func__, OIC_JSON_ACES_NAME);
     }
 
@@ -452,14 +452,14 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
     if (OIC_SEC_ACL_V1 == aclVersion)
     {
         cborEncoderResult = cbor_encoder_create_array(&aclListMap, &acesArray, OicSecAclSize(secAcl));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating ACE Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Creating ACE Array.");
         OIC_LOG_V(DEBUG, TAG, "%s created v1 ACE array.", __func__);
     }
     else
     // v2 create ACE2 array in acl map
     {
         cborEncoderResult = cbor_encoder_create_array(&aclMap, &acesArray, OicSecAclSize(secAcl));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating ACE2 Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Creating ACE2 Array.");
         OIC_LOG_V(DEBUG, TAG, "%s created v2 ACE2 array.", __func__);
     }
 
@@ -484,7 +484,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
         if ((OIC_SEC_ACL_V2 > aclVersion) && (OicSecAceRoleSubject == ace->subjectType))
         {
             cborEncoderResult = CborUnknownError;
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "ACE has a role subject; can't create a V1 ACL payload for this ACL.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "ACE has a role subject; can't create a V1 ACL payload for this ACL.");
         }
 
         OicSecValidity_t* validityElts = ace->validities;
@@ -508,7 +508,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
 #endif //MULTIPLE_OWNER
 
         cborEncoderResult = cbor_encoder_create_map(&acesArray, &oicSecAclMap, aceMapSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating ACES Map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Creating ACES Map");
         OIC_LOG_V(DEBUG, TAG, "%s created %s map.",
             __func__, OIC_SEC_ACL_V1 == aclVersion?"v1 ACE":"v2 ACE2");
 
@@ -517,10 +517,10 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
         {
             cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_ACEID_NAME,
                 strlen(OIC_JSON_ACEID_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding aceid Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding aceid Tag.");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_ACEID_NAME);
             cborEncoderResult = cbor_encode_int(&oicSecAclMap, ace->aceid);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding aceid Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding aceid Value.");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v2 aceid value %d.", __func__, ace->aceid);
         }
 
@@ -529,7 +529,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
         {
             cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_SUBJECTID_NAME,
                 strlen(OIC_JSON_SUBJECTID_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding subjectuuid Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding subjectuuid Tag.");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v1 %s tag.", __func__, OIC_JSON_SUBJECTID_NAME);
         }
         // v2 has a "subject" tag, and then one of three different subject types: UUID, roletype or conntype
@@ -537,7 +537,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
         {
             cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_SUBJECT_NAME,
                 strlen(OIC_JSON_SUBJECT_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding subject Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding subject Tag.");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_SUBJECT_NAME);
         }
 
@@ -552,13 +552,13 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 {
                     cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, WILDCARD_RESOURCE_URI,
                         strlen(WILDCARD_RESOURCE_URI));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding subjectuud wildcard URI value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding subjectuud wildcard URI value.");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded subjectuuid wildcard value %s.", __func__, WILDCARD_RESOURCE_URI);
                 }
                 else // v2
                 {
                     cborEncoderResult = CborUnknownError;
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "ACE has wildcard subjectuuid; cannot encode into oic.sec.ace2 object.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "ACE has wildcard subjectuuid; cannot encode into oic.sec.ace2 object.");
                 }
             }
             else
@@ -570,14 +570,14 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 }
                 ret = ConvertUuidToStr(&ace->subjectuuid, &subjectuuidstring);
                 cborEncoderResult = (OC_STACK_OK == ret) ? CborNoError : CborUnknownError;
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to convert subject UUID to string");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to convert subject UUID to string");
                 OIC_LOG_V(DEBUG, TAG, "%s converted UUID to %s", __func__, subjectuuidstring);
 
                 // v1 encodes the UUID immediately after the "subjectuuid" tag encoded above
                 if (OIC_SEC_ACL_V1 == aclVersion)
                 {
                     cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, subjectuuidstring, strlen(subjectuuidstring));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding subjectuuid Value");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding subjectuuid Value");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v1 UUID value %s.", __func__, subjectuuidstring);
                 }
                 // v2 encodes another tag and then the value, depending on the type (UUID, role or conn)
@@ -587,15 +587,15 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                     CborEncoder didMap;
 
                     cborEncoderResult = cbor_encoder_create_map(&oicSecAclMap, &didMap, ACE_DID_MAP_SIZE);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating did map");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating did map");
                     OIC_LOG_V(DEBUG, TAG, "%s created v2 did map.", __func__);
 
                     cborEncoderResult = cbor_encode_text_string(&didMap, OIC_JSON_UUID_NAME, strlen(OIC_JSON_UUID_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding uuid tag");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding uuid tag");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_UUID_NAME);
 
                     cborEncoderResult = cbor_encode_text_string(&didMap, subjectuuidstring, strlen(subjectuuidstring));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding Subject UUID Value");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding Subject UUID Value");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v2 UUID value %s.", __func__, subjectuuidstring);
                     if (NULL != subjectuuidstring)
                     {
@@ -604,7 +604,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                     }
 
                     cborEncoderResult = cbor_encoder_close_container(&oicSecAclMap, &didMap);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing did map");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing did map");
                     OIC_LOG_V(DEBUG, TAG, "%s closed v2 did map.", __func__);
                 }
             }
@@ -618,30 +618,30 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
             bool includeAuthority = (0 != memcmp(&ace->subjectRole.authority, &EMPTY_ROLE.authority, sizeof(EMPTY_ROLE.authority)));
 
             cborEncoderResult = cbor_encoder_create_map(&oicSecAclMap, &roleMap, ACE_ROLE_MAP_SIZE + (includeAuthority ? 1 : 0));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating role map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating role map");
             OIC_LOG_V(DEBUG, TAG, "%s created v2 role map.", __func__);
 
             cborEncoderResult = cbor_encode_text_string(&roleMap, OIC_JSON_ROLE_NAME, strlen(OIC_JSON_ROLE_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding roleid tag");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding roleid tag");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_ROLE_NAME);
 
             cborEncoderResult = cbor_encode_text_string(&roleMap, ace->subjectRole.id, strlen(ace->subjectRole.id));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding roleid value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding roleid value");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v2 roleid value %s.", __func__, ace->subjectRole.id);
 
             if (includeAuthority)
             {
                 cborEncoderResult = cbor_encode_text_string(&roleMap, OIC_JSON_AUTHORITY_NAME, strlen(OIC_JSON_AUTHORITY_NAME));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding authority tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding authority tag");
                 OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_AUTHORITY_NAME);
 
                 cborEncoderResult = cbor_encode_text_string(&roleMap, ace->subjectRole.authority, strlen(ace->subjectRole.authority));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding authority value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding authority value");
                 OIC_LOG_V(DEBUG, TAG, "%s encoded v2 authority value %s.", __func__, ace->subjectRole.authority);
             }
 
             cborEncoderResult = cbor_encoder_close_container(&oicSecAclMap, &roleMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing role map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing role map");
             OIC_LOG_V(DEBUG, TAG, "%s closed v2 role map.", __func__);
         }
         // v2 conntype
@@ -651,23 +651,23 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
             CborEncoder connMap;
 
             cborEncoderResult = cbor_encoder_create_map(&oicSecAclMap, &connMap, ACE_CONN_MAP_SIZE);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating conn map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating conn map");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v2 conn map.", __func__);
 
             cborEncoderResult = cbor_encode_text_string(&connMap, OIC_JSON_CONNTYPE_NAME, strlen(OIC_JSON_CONNTYPE_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding conntype tag");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding conntype tag");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_CONNTYPE_NAME);
 
             if (AUTH_CRYPT == ace->subjectConn)
             {
                 cborEncoderResult = cbor_encode_text_string(&connMap, OIC_JSON_AUTHCRYPT_NAME, strlen(OIC_JSON_AUTHCRYPT_NAME));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding auth-crypt value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding auth-crypt value");
                 OIC_LOG_V(DEBUG, TAG, "%s encoded v2 conntype value %s.", __func__, OIC_JSON_AUTHCRYPT_NAME);
             }
             else if (ANON_CLEAR == ace->subjectConn)
             {
                 cborEncoderResult = cbor_encode_text_string(&connMap, OIC_JSON_ANONCLEAR_NAME, strlen(OIC_JSON_AUTHCRYPT_NAME));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding anon-clear value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding anon-clear value");
                 OIC_LOG_V(DEBUG, TAG, "%s encoded v2 conntype value %s.", __func__, OIC_JSON_ANONCLEAR_NAME);
             }
             else
@@ -676,11 +676,11 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 assert(!"unknown conntype value");
                 cborEncoderResult = CborUnknownError;
                 ret = OC_STACK_ERROR;
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "unknown conntype value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "unknown conntype value");
             }
 
             cborEncoderResult = cbor_encoder_close_container(&oicSecAclMap, &connMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing conn map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing conn map");
             ret = OC_STACK_ERROR;
             OIC_LOG_V(DEBUG, TAG, "%s closed v2 conn map.", __func__);
         }
@@ -689,7 +689,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
             assert(!"Unknown ACE subject type");
             cborEncoderResult = CborUnknownError;
             ret = OC_STACK_ERROR;
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Unknown ACE subject type");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Unknown ACE subject type");
         }
 
         // Resources
@@ -697,7 +697,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
             CborEncoder resources;
             cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_RESOURCES_NAME,
                 strlen(OIC_JSON_RESOURCES_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Resource Name Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Resource Name Tag.");
             OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_RESOURCES_NAME);
 
             size_t rsrcLen = 0;
@@ -708,7 +708,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
             }
 
             cborEncoderResult = cbor_encoder_create_array(&oicSecAclMap, &resources, rsrcLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating resources Array.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating resources Array.");
             OIC_LOG_V(DEBUG, TAG, "%s created v1/v2 resources array.", __func__);
 
             OicSecRsrc_t* rsrc = NULL;
@@ -740,7 +740,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 OIC_LOG_V(DEBUG, TAG, "%s resource map size = %"PRIuPTR, __func__, rsrcMapSize);
 
                 cborEncoderResult = cbor_encoder_create_map(&resources, &rMap, rsrcMapSize);
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Resource Map.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Resource Map.");
                 OIC_LOG_V(DEBUG, TAG, "%s created v1/v2 resource map.", __func__);
 
                 // href
@@ -748,10 +748,10 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 {
                     cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_HREF_NAME,
                         strlen(OIC_JSON_HREF_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding HREF Name Tag.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding HREF Name Tag.");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_HREF_NAME);
                     cborEncoderResult = cbor_encode_text_string(&rMap, rsrc->href, strlen(rsrc->href));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding HREF Value in Map.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding HREF Value in Map.");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 href value %s.", __func__, rsrc->href);
                 }
 
@@ -760,21 +760,21 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 {
                     cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_RT_NAME,
                         strlen(OIC_JSON_RT_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Name Tag.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Name Tag.");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_RT_NAME);
 
                     CborEncoder resourceTypes;
                     cborEncoderResult = cbor_encoder_create_array(&rMap, &resourceTypes, rsrc->typeLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating RT Array.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating RT Array.");
                     OIC_LOG_V(DEBUG, TAG, "%s created v1/v2 rt array.", __func__);
                     for(size_t i = 0; i < rsrc->typeLen; i++)
                     {
                         cborEncoderResult = cbor_encode_text_string(&resourceTypes, rsrc->types[i], strlen(rsrc->types[i]));
-                        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
                         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 rt value %s.", __func__, rsrc->types[i]);
                     }
                     cborEncoderResult = cbor_encoder_close_container(&rMap, &resourceTypes);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing resourceTypes.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing resourceTypes.");
                     OIC_LOG_V(DEBUG, TAG, "%s closed v1/v2 resource map.", __func__);
                 }
 
@@ -783,21 +783,21 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 {
                     cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_IF_NAME,
                         strlen(OIC_JSON_IF_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Name Tag.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Name Tag.");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_IF_NAME);
 
                     CborEncoder interfaces;
                     cborEncoderResult = cbor_encoder_create_array(&rMap, &interfaces, rsrc->interfaceLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating IF Array.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating IF Array.");
                     OIC_LOG_V(DEBUG, TAG, "%s created v1/v2 IF array.", __func__);
                     for(size_t i = 0; i < rsrc->interfaceLen; i++)
                     {
                         cborEncoderResult = cbor_encode_text_string(&interfaces, rsrc->interfaces[i], strlen(rsrc->interfaces[i]));
-                        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
                         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 IF value %s.", __func__, rsrc->interfaces[i]);
                     }
                     cborEncoderResult = cbor_encoder_close_container(&rMap, &interfaces);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing interfaces.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing interfaces.");
                 }
 
                 // rel
@@ -805,10 +805,10 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 {
                     cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_REL_NAME,
                             strlen(OIC_JSON_REL_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding REL Name Tag.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding REL Name Tag.");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_REL_NAME);
                     cborEncoderResult = cbor_encode_text_string(&rMap, rsrc->rel, strlen(rsrc->rel));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding REL Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding REL Value.");
                     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 rel value %s.", __func__, rsrc->rel);
                 }
 
@@ -819,7 +819,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                     {
                         cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_WC_NAME,
                             strlen(OIC_JSON_WC_NAME));
-                        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding WC Name Tag.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding WC Name Tag.");
                         OIC_LOG_V(DEBUG, TAG, "%s encoded v2 %s tag.", __func__, OIC_JSON_WC_NAME);
                         switch(rsrc->wildcard)
                         {
@@ -834,32 +834,32 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                             break;
                             default:
                             OIC_LOG_V(ERROR, TAG, "%s: unknown ACE2 wildcard type.", __func__);
-                            VERIFY_CBOR_SUCCESS(TAG, CborUnknownError, "unknown ACE2 wildcard type");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, CborUnknownError, "unknown ACE2 wildcard type");
                             break;
                         }
                         cborEncoderResult = cbor_encode_text_string(&rMap, wcstring, strlen(wcstring));
-                        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding WC Value.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding WC Value.");
                         OIC_LOG_V(DEBUG, TAG, "%s encoded v2 wc value %s.", __func__, wcstring);
                         wcstring = NULL;
                     }
                 }
 
                 cborEncoderResult = cbor_encoder_close_container(&resources, &rMap);
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Resource Map.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Resource Map.");
                 OIC_LOG_V(DEBUG, TAG, "%s closed v1/v2 resource map.", __func__);
             }
             cborEncoderResult = cbor_encoder_close_container(&oicSecAclMap, &resources);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Resource Name Array.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Resource Name Array.");
             OIC_LOG_V(DEBUG, TAG, "%s closed v1/v2 resources array.", __func__);
         }
 
         // Permissions -- Mandatory
         cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_PERMISSION_NAME,
             strlen(OIC_JSON_PERMISSION_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Permission Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Permission Name Tag.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_PERMISSION_NAME);
         cborEncoderResult = cbor_encode_int(&oicSecAclMap, ace->permission);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Permission Name Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Permission Name Value.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 permission value %d.", __func__, ace->permission);
 
         // TODO: Need to verfication for validity
@@ -876,9 +876,9 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
             CborEncoder validities;
             cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_VALIDITY_NAME,
                 strlen(OIC_JSON_VALIDITY_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Validity Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Validity Tag.");
             cborEncoderResult = cbor_encoder_create_array(&oicSecAclMap, &validities, validityLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Validities Array.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Validities Array.");
 
             //How to add the value w/o "title" using tinycobr...? :(
 
@@ -897,14 +897,14 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 }
 
                 cborEncoderResult = cbor_encoder_create_array(&validities, &validity, validitySize);
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Validity Array.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Validity Array.");
 
                 // Period
                 if (validityElts->period)
                 {
                     cborEncoderResult = cbor_encode_text_string(&validity, validityElts->period,
                         strlen(validityElts->period));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Period Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Period Value.");
                 }
 
                 // Recurrence
@@ -912,24 +912,24 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
                 {
                     CborEncoder recurrences;
                     cborEncoderResult = cbor_encoder_create_array(&validity, &recurrences, validityElts->recurrenceLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Recurrence Array.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Recurrence Array.");
 
                     for (size_t i = 0; i < validityElts->recurrenceLen; i++)
                     {
                         cborEncoderResult = cbor_encode_text_string(&recurrences, validityElts->recurrences[i],
                             strlen(validityElts->recurrences[i]));
-                        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Recurrence Array Value.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Recurrence Array Value.");
                     }
                     cborEncoderResult = cbor_encoder_close_container(&validity, &recurrences);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Recurrence Array");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Recurrence Array");
                 }
 
                 cborEncoderResult = cbor_encoder_close_container(&validities, &validity);
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Validity Array.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Validity Array.");
             }
 
             cborEncoderResult = cbor_encoder_close_container(&oicSecAclMap, &validities);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Validities Array.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Validities Array.");
         }
 
 #ifdef MULTIPLE_OWNER
@@ -939,18 +939,18 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
             char *eowner = NULL;
             cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_EOWNERID_NAME,
                 strlen(OIC_JSON_EOWNERID_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding eownerId Name Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding eownerId Name Tag.");
             ret = ConvertUuidToStr(ace->eownerID, &eowner);
             VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
             cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, eowner, strlen(eowner));
             OICFree(eowner);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding eownerId Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding eownerId Value.");
         }
 #endif //MULTIPLE_OWNER
 
         // close the map of the oic.sec.ace/ace2 object
         cborEncoderResult = cbor_encoder_close_container(&acesArray, &oicSecAclMap);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing ACES Map.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing ACES Map.");
         OIC_LOG_V(DEBUG, TAG, "%s closed v1/v2 aces map.", __func__);
     }
 
@@ -958,13 +958,13 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
     if (OIC_SEC_ACL_V1 == aclVersion)
     {
         cborEncoderResult = cbor_encoder_close_container(&aclListMap, &acesArray);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing ACE Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing ACE Array.");
         OIC_LOG_V(DEBUG, TAG, "%s closed v1 ACE array.", __func__);
     }
     else
     {
         cborEncoderResult = cbor_encoder_close_container(&aclMap, &acesArray);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing ACE2 Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing ACE2 Array.");
         OIC_LOG_V(DEBUG, TAG, "%s closed v2 ACE2 array.", __func__);
     }
 
@@ -972,7 +972,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
     if (OIC_SEC_ACL_V1 == aclVersion)
     {
         cborEncoderResult = cbor_encoder_close_container(&aclMap, &aclListMap);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing aclist/aclist2 Map.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing aclist/aclist2 Map.");
         OIC_LOG_V(DEBUG, TAG, "%s closed v1/v2 aclist/aclist2 map.", __func__);
     }
 
@@ -981,12 +981,12 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
         char *rowner = NULL;
         cborEncoderResult = cbor_encode_text_string(&aclMap, OIC_JSON_ROWNERID_NAME,
             strlen(OIC_JSON_ROWNERID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding rownerid Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding rownerid Name.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_ROWNERID_NAME);
         ret = ConvertUuidToStr(&secAcl->rownerID, &rowner);
         VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
         cborEncoderResult = cbor_encode_text_string(&aclMap, rowner, strlen(rowner));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding rownerid Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding rownerid Value.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 rowneruuid value %s.", __func__, rowner);
         OICFree(rowner);
     }
@@ -995,47 +995,47 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl,
     CborEncoder rtArray;
     cborEncoderResult = cbor_encode_text_string(&aclMap, OIC_JSON_RT_NAME,
             strlen(OIC_JSON_RT_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Tag.");
     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_RT_NAME);
     cborEncoderResult = cbor_encoder_create_array(&aclMap, &rtArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating RT array.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating RT array.");
     OIC_LOG_V(DEBUG, TAG, "%s created %s array.", __func__, OIC_JSON_RT_NAME);
     aclRsrcType = (OIC_SEC_ACL_V1 == aclVersion)?OIC_RSRC_TYPE_SEC_ACL:OIC_RSRC_TYPE_SEC_ACL2;
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&rtArray, aclRsrcType,
                 strlen(aclRsrcType));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, aclRsrcType);
     }
     aclRsrcType = NULL;
     cborEncoderResult = cbor_encoder_close_container(&aclMap, &rtArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RT.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RT.");
     OIC_LOG_V(DEBUG, TAG, "%s closed %s array.", __func__, OIC_JSON_RT_NAME);
 
     //IF-- Mandatory
     CborEncoder ifArray;
     cborEncoderResult = cbor_encode_text_string(&aclMap, OIC_JSON_IF_NAME,
              strlen(OIC_JSON_IF_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Name Tag.");
     OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 %s tag.", __func__, OIC_JSON_IF_NAME);
     cborEncoderResult = cbor_encoder_create_array(&aclMap, &ifArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating IF array.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating IF array.");
     OIC_LOG_V(DEBUG, TAG, "%s created %s array.", __func__, OIC_JSON_IF_NAME);
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&ifArray, OC_RSRVD_INTERFACE_DEFAULT,
                 strlen(OC_RSRVD_INTERFACE_DEFAULT));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
         OIC_LOG_V(DEBUG, TAG, "%s encoded v1/v2 IF value %s.", __func__, OC_RSRVD_INTERFACE_DEFAULT);
     }
     cborEncoderResult = cbor_encoder_close_container(&aclMap, &ifArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing IF.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing IF.");
     OIC_LOG_V(DEBUG, TAG, "%s closed IF array.", __func__);
 
     // Close ACL Map
     cborEncoderResult = cbor_encoder_close_container(&encoder, &aclMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing ACL Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing ACL Map.");
     OIC_LOG_V(DEBUG, TAG, "%s closed ACL map.", __func__);
 
     if (CborNoError == cborEncoderResult)
@@ -1101,7 +1101,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
     // Enter ACL Map
     CborValue aclMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
     cborFindResult = cbor_value_enter_container(&aclCbor, &aclMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering ACL Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACL Map.");
 
     while (cbor_value_is_valid(&aclMap))
     {
@@ -1111,9 +1111,9 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
         if (type == CborTextStringType)
         {
             cborFindResult = cbor_value_dup_text_string(&aclMap, &tagName, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Name in ACL Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Name in ACL Map.");
             cborFindResult = cbor_value_advance(&aclMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Value in ACL Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Value in ACL Map.");
         }
         if(tagName)
         {
@@ -1122,7 +1122,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                 // Enter ACES Array
                 CborValue acesArray = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
                 cborFindResult = cbor_value_enter_container(&aclMap, &acesArray);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering ACES Array.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACES Array.");
 
                 int acesCount = 0;
                 while (cbor_value_is_valid(&acesArray))
@@ -1130,7 +1130,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                     acesCount++;
                     CborValue aceMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
                     cborFindResult = cbor_value_enter_container(&acesArray, &aceMap);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering ACE Map.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACE Map.");
 
                     OicSecAce_t *ace = NULL;
                     ace = (OicSecAce_t *) OICCalloc(1, sizeof(OicSecAce_t));
@@ -1147,9 +1147,9 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                         if (aceMapType == CborTextStringType)
                         {
                             cborFindResult = cbor_value_dup_text_string(&aceMap, &name, &tempLen, NULL);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Name in ACE Map.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Name in ACE Map.");
                             cborFindResult = cbor_value_advance(&aceMap);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Value in ACE Map.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Value in ACE Map.");
                         }
                         if (name)
                         {
@@ -1158,7 +1158,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                             {
                                 char *subject = NULL;
                                 cborFindResult = cbor_value_dup_text_string(&aceMap, &subject, &tempLen, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding subject Value.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding subject Value.");
                                 if(strcmp(subject, WILDCARD_RESOURCE_URI) == 0)
                                 {
                                     ace->subjectuuid.id[0] = '*';
@@ -1178,14 +1178,14 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                             {
                                 CborValue resources = { .parser = NULL };
                                 cborFindResult = cbor_value_enter_container(&aceMap, &resources);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering a Resource Array.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering a Resource Array.");
 
                                 while (cbor_value_is_valid(&resources))
                                 {
                                     // rMap
                                     CborValue rMap = { .parser = NULL  };
                                     cborFindResult = cbor_value_enter_container(&resources, &rMap);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering Resource Map");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering Resource Map");
 
                                     OicSecRsrc_t* rsrc = (OicSecRsrc_t*)OICCalloc(1, sizeof(OicSecRsrc_t));
                                     VERIFY_NOT_NULL(TAG, rsrc, ERROR);
@@ -1196,22 +1196,22 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                                         char *rMapName = NULL;
                                         size_t rMapNameLen = 0;
                                         cborFindResult = cbor_value_dup_text_string(&rMap, &rMapName, &rMapNameLen, NULL);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RMap Data Name Tag.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RMap Data Name Tag.");
                                         cborFindResult = cbor_value_advance(&rMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RMap Data Value.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RMap Data Value.");
 
                                         // "href"
                                         if (0 == strcmp(OIC_JSON_HREF_NAME, rMapName))
                                         {
                                             cborFindResult = cbor_value_dup_text_string(&rMap, &rsrc->href, &tempLen, NULL);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Href Value.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Href Value.");
                                         }
 
                                         // "rt"
                                         if (0 == strcmp(OIC_JSON_RT_NAME, rMapName) && cbor_value_is_array(&rMap))
                                         {
                                             cbor_value_get_array_length(&rMap, &rsrc->typeLen);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RT array length.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RT array length.");
                                             VERIFY_SUCCESS(TAG, (0 != rsrc->typeLen), ERROR);
 
                                             rsrc->types = (char**)OICCalloc(rsrc->typeLen, sizeof(char*));
@@ -1219,15 +1219,15 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
 
                                             CborValue resourceTypes;
                                             cborFindResult = cbor_value_enter_container(&rMap, &resourceTypes);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering RT Array.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering RT Array.");
 
                                             for(size_t i = 0; cbor_value_is_valid(&resourceTypes) && cbor_value_is_text_string(&resourceTypes); i++)
                                             {
                                                 size_t readLen = 0;
                                                 cborFindResult = cbor_value_dup_text_string(&resourceTypes, &(rsrc->types[i]), &readLen, NULL);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding resource type.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding resource type.");
                                                 cborFindResult = cbor_value_advance(&resourceTypes);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing resource type.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing resource type.");
                                             }
                                         }
 
@@ -1235,7 +1235,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                                         if (0 == strcmp(OIC_JSON_IF_NAME, rMapName) && cbor_value_is_array(&rMap))
                                         {
                                             cbor_value_get_array_length(&rMap, &rsrc->interfaceLen);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding IF array length.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding IF array length.");
                                             VERIFY_SUCCESS(TAG, (0 != rsrc->interfaceLen), ERROR);
 
                                             rsrc->interfaces = (char**)OICCalloc(rsrc->interfaceLen, sizeof(char*));
@@ -1243,15 +1243,15 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
 
                                             CborValue interfaces;
                                             cborFindResult = cbor_value_enter_container(&rMap, &interfaces);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering IF Array.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering IF Array.");
 
                                             for(size_t i = 0; cbor_value_is_valid(&interfaces) && cbor_value_is_text_string(&interfaces); i++)
                                             {
                                                 size_t readLen = 0;
                                                 cborFindResult = cbor_value_dup_text_string(&interfaces, &(rsrc->interfaces[i]), &readLen, NULL);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding IF type.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding IF type.");
                                                 cborFindResult = cbor_value_advance(&interfaces);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing IF type.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing IF type.");
                                             }
                                         }
 
@@ -1259,13 +1259,13 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                                         if (0 == strcmp(OIC_JSON_REL_NAME, rMapName))
                                         {
                                             cborFindResult = cbor_value_dup_text_string(&rMap, &rsrc->rel, &tempLen, NULL);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding REL Value.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding REL Value.");
                                         }
 
                                         if (cbor_value_is_valid(&rMap))
                                         {
                                             cborFindResult = cbor_value_advance(&rMap);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Rlist Map.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Rlist Map.");
                                         }
                                         OICFree(rMapName);
                                     }
@@ -1273,7 +1273,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                                     if (cbor_value_is_valid(&resources))
                                     {
                                         cborFindResult = cbor_value_advance(&resources);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Resource Array.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Resource Array.");
                                     }
                                 }
                             }
@@ -1283,7 +1283,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                             {
                                 uint64_t tmp64;
                                 cborFindResult = cbor_value_get_uint64(&aceMap, &tmp64);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a PERM Value.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a PERM Value.");
                                 ace->permission = (uint16_t)tmp64;
                             }
 
@@ -1295,10 +1295,10 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                                 size_t validitySize = 0;
 
                                 cborFindResult = cbor_value_get_array_length(&aceMap, &validitySize);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a Validity Array Length.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a Validity Array Length.");
 
                                 cborFindResult = cbor_value_enter_container(&aceMap, &validitiesMap);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a validity Array Map.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a validity Array Map.");
 
                                 while(cbor_value_is_valid(&validitiesMap))
                                 {
@@ -1309,19 +1309,19 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                                     CborValue validityMap  = {.parser = NULL};
                                     //period (string)
                                     cborFindResult = cbor_value_enter_container(&validitiesMap, &validityMap);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a validity Map.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a validity Map.");
 
                                     size_t vmLen = 0;
                                     cborFindResult = cbor_value_dup_text_string(&validityMap, &validity->period, &vmLen, NULL);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a Period value.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a Period value.");
 
                                     //recurrence (string array)
                                     CborValue recurrenceMap  = {.parser = NULL};
                                     cborFindResult = cbor_value_enter_container(&validityMap, &recurrenceMap);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a recurrence array.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a recurrence array.");
 
                                     cborFindResult = cbor_value_get_array_length(&recurrenceMap, &validity->recurrenceLen);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Adding Recurrence Array.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Adding Recurrence Array.");
 
                                     validity->recurrences = (char**)OICCalloc(validity->recurrenceLen, sizeof(char*));
                                     VERIFY_NOT_NULL(TAG, validity->recurrences, ERROR);
@@ -1329,14 +1329,14 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                                     for(size_t i = 0; cbor_value_is_text_string(&recurrenceMap) && i < validity->recurrenceLen; i++)
                                     {
                                         cborFindResult = cbor_value_dup_text_string(&recurrenceMap, &validity->recurrences[i], &vmLen, NULL);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a recurrence Value.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a recurrence Value.");
 
                                         cborFindResult = cbor_value_advance(&recurrenceMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing a recurrences Array.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing a recurrences Array.");
                                     }
 
                                     cborFindResult = cbor_value_advance(&validitiesMap);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing a validities Array.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing a validities Array.");
                                 }
                             }
                             OICFree(name);
@@ -1345,14 +1345,14 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
                         if (aceMapType != CborMapType && cbor_value_is_valid(&aceMap))
                         {
                             cborFindResult = cbor_value_advance(&aceMap);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing the Array.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing the Array.");
                         }
                     }
 
                     if (cbor_value_is_valid(&acesArray))
                     {
                         cborFindResult = cbor_value_advance(&acesArray);
-                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing ACL Array.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing ACL Array.");
                     }
                 }
             }
@@ -1362,7 +1362,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
             {
                 char *stRowner = NULL;
                 cborFindResult = cbor_value_dup_text_string(&aclMap, &stRowner, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Rownerid Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Rownerid Value.");
                 OIC_LOG_V(DEBUG, TAG, "Converting rownerid = %s to uuid...", stRowner);
                 ret = ConvertStrToUuid(stRowner, &acl->rownerID);
                 free(stRowner);
@@ -1375,7 +1375,7 @@ OicSecAcl_t* CBORPayloadToCloudAcl(const uint8_t *cborPayload, const size_t size
         if (cbor_value_is_valid(&aclMap))
         {
             cborFindResult = cbor_value_advance(&aclMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing ACL Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing ACL Map.");
         }
     }
 
@@ -1431,7 +1431,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
 
     // Enter ACL Map
     cborFindResult = cbor_value_enter_container(&aclCbor, &aclMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering ACL Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACL Map.");
     while (cbor_value_is_valid(&aclMap))
     {
         size_t len = 0;
@@ -1439,9 +1439,9 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
         if (type == CborTextStringType)
         {
             cborFindResult = cbor_value_dup_text_string(&aclMap, &tagName, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Name in ACL Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Name in ACL Map.");
             cborFindResult = cbor_value_advance(&aclMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Value in ACL Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Value in ACL Map.");
         }
         if(tagName)
         {
@@ -1491,7 +1491,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                 aclistTagJustFound = false; // don't enter this check a second time
                 // Enter ACLIST Map
                 cborFindResult = cbor_value_enter_container(&aclMap, &aclistMap);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering ACLIST Map.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACLIST Map.");
                 OIC_LOG_V(DEBUG, TAG, "%s entered 'aclist' map.", __func__);
 
                 bool parsedAcesTag = false;
@@ -1501,9 +1501,9 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                 if (acType == CborTextStringType)
                 {
                     cborFindResult = cbor_value_dup_text_string(&aclistMap, &acName, &readLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Name in ACLIST Map.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Name in ACLIST Map.");
                     cborFindResult = cbor_value_advance(&aclistMap);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Value in ACLIST Map.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Value in ACLIST Map.");
                     if (acName)
                     {
                         if (strcmp(acName, OIC_JSON_ACES_NAME)  == 0)
@@ -1540,7 +1540,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                     // Enter ACES Array
                     CborValue acesArray = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
                     cborFindResult = cbor_value_enter_container(&aclistMap, &acesArray);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering ACES Array.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACES Array.");
                     OIC_LOG_V(DEBUG, TAG, "%s entered ace object array.", __func__);
 
                     // decode array of ace or ace2 objects
@@ -1551,7 +1551,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                         acesCount++;
                         CborValue aceMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
                         cborFindResult = cbor_value_enter_container(&acesArray, &aceMap);
-                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering ACE Map.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACE Map.");
                         OIC_LOG_V(DEBUG, TAG, "%s entered %s map.", __func__,
                             (OIC_SEC_ACL_V1 == aclistVersion)?"ace":"ace2");
 
@@ -1569,10 +1569,10 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                             if (aceMapType == CborTextStringType)
                             {
                                 cborFindResult = cbor_value_dup_text_string(&aceMap, &name, &tempLen, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Name in ACE Map.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Name in ACE Map.");
                                 OIC_LOG_V(DEBUG, TAG, "%s found %s tag.", __func__, name);
                                 cborFindResult = cbor_value_advance(&aceMap);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Value in ACE Map.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Value in ACE Map.");
                                 OIC_LOG_V(DEBUG, TAG, "%s advanced to next value.", __func__);
                             }
                             if (name)
@@ -1582,7 +1582,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                 {
                                     uint64_t tmp64;
                                     cborFindResult = cbor_value_get_uint64(&aceMap, &tmp64);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding aceid Value.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding aceid Value.");
                                     OIC_LOG_V(DEBUG, TAG, "%s read aceid value %d.", __func__, (uint16_t)tmp64);
                                     ace->aceid = (uint16_t)tmp64;
                                 }
@@ -1593,7 +1593,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                     {
                                         char *subject = NULL;
                                         cborFindResult = cbor_value_dup_text_string(&aceMap, &subject, &tempLen, NULL);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding subject Value.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding subject Value.");
                                         if (0 == strcmp(subject, WILDCARD_RESOURCE_URI))
                                         {
                                             ace->subjectuuid.id[0] = '*';
@@ -1607,7 +1607,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             {
                                                 cborFindResult = CborUnknownError;
                                                 free(subject);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed converting subject UUID");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed converting subject UUID");
                                             }
                                             OIC_LOG_V(DEBUG, TAG, "%s found subjectuuid = %s.", __func__, subject);
                                             ace->subjectType = OicSecAceUuidSubject;
@@ -1626,16 +1626,16 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                     {
                                         // next container within subject is either didtype, roletype, or conntype
                                         cborFindResult = cbor_value_enter_container(&aceMap, &subjectMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed entering subject map.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed entering subject map.");
                                         OIC_LOG_V(DEBUG, TAG, "%s entered acl2 subject map.", __func__);
 
                                         while (cbor_value_is_valid(&subjectMap) && cbor_value_is_text_string(&subjectMap))
                                         {
                                             cborFindResult = cbor_value_dup_text_string(&subjectMap, &subjectTag, &unusedLen, NULL);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting subject type tag name");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting subject type tag name");
                                             OIC_LOG_V(DEBUG, TAG, "%s found %s tag.", __func__, subjectTag);
                                             cborFindResult = cbor_value_advance(&subjectMap);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing subjectMap");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing subjectMap");
                                             OIC_LOG_V(DEBUG, TAG, "%s advanced acl2 subject map.", __func__);
                                             if (NULL != subjectTag)
                                             {
@@ -1646,14 +1646,14 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                                     if (cbor_value_is_valid(&subjectMap) && cbor_value_is_text_string(&subjectMap))
                                                     {
                                                         cborFindResult = cbor_value_dup_text_string(&subjectMap, &subject, &tempLen, NULL);
-                                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding subject Value.");
+                                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding subject Value.");
                                                         OIC_LOG_V(DEBUG, TAG, "%s read UUID = %s", __func__, subject);
                                                         ret = ConvertStrToUuid(subject, &ace->subjectuuid);
                                                         if (OC_STACK_OK != ret)
                                                         {
                                                             cborFindResult = CborUnknownError;
                                                             free(subject);
-                                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed converting subject UUID");
+                                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed converting subject UUID");
                                                         }
                                                         ace->subjectType = OicSecAceUuidSubject;
                                                         free(subject);
@@ -1669,12 +1669,12 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                                     ace->subjectType = OicSecAceRoleSubject;
                                                     char *roleId = NULL;
                                                     cborFindResult = cbor_value_dup_text_string(&subjectMap, &roleId, &unusedLen, NULL);
-                                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting role id value");
+                                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting role id value");
                                                     if (strlen(roleId) >= sizeof(ace->subjectRole.id))
                                                     {
                                                         cborFindResult = CborUnknownError;
                                                         free(roleId);
-                                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Role ID is too long");
+                                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Role ID is too long");
                                                     }
                                                     OICStrcpy(ace->subjectRole.id, sizeof(ace->subjectRole.id), roleId);
                                                     free(roleId);
@@ -1685,12 +1685,12 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                                     ace->subjectType = OicSecAceRoleSubject;
                                                     char *authorityName = NULL;
                                                     cborFindResult = cbor_value_dup_text_string(&subjectMap, &authorityName, &unusedLen, NULL);
-                                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting role authority value");
+                                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting role authority value");
                                                     if (strlen(authorityName) >= sizeof(ace->subjectRole.authority))
                                                     {
                                                         cborFindResult = CborUnknownError;
                                                         free(authorityName);
-                                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Authority name is too long");
+                                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Authority name is too long");
                                                     }
                                                     OICStrcpy(ace->subjectRole.authority, sizeof(ace->subjectRole.authority), authorityName);
                                                     ace->subjectType = OicSecAceRoleSubject;
@@ -1701,7 +1701,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                                 {
                                                     char *conntype = NULL;
                                                     cborFindResult = cbor_value_dup_text_string(&subjectMap, &conntype, &unusedLen, NULL);
-                                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting conntype value");
+                                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting conntype value");
                                                     OIC_LOG_V(DEBUG, TAG, "%s read conntype value %s.", __func__, conntype);
                                                     if (0 == strcmp(conntype, OIC_JSON_AUTHCRYPT_NAME))
                                                     {
@@ -1715,7 +1715,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                                     {
                                                         cborFindResult = CborUnknownError;
                                                         free(conntype);
-                                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "conntype value not recognized.");
+                                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "conntype value not recognized.");
                                                     }
                                                     ace->subjectType = OicSecAceConntypeSubject;
                                                     free(conntype);
@@ -1730,7 +1730,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             if (cbor_value_is_valid(&subjectMap))
                                             {
                                                 cborFindResult = cbor_value_advance(&subjectMap);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing subject map");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing subject map");
                                                 OIC_LOG_V(DEBUG, TAG, "%s advanced ace2 subject map.", __func__);
                                             }
                                         }
@@ -1741,7 +1741,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             if ('\0' == ace->subjectRole.id[0])
                                             {
                                                 cborFindResult = CborUnknownError;
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "ID for role was not present in role map");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "ID for role was not present in role map");
                                             }
                                         }
                                     }
@@ -1749,7 +1749,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                     {
                                         cborFindResult = CborUnknownError;
                                         OIC_LOG_V(ERROR, TAG, "Unknown subject value type: %d", cbor_value_get_type(&aceMap));
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Type of subject value was not expected");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Type of subject value was not expected");
                                     }
                                 }
 
@@ -1758,7 +1758,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                 {
                                     CborValue resources = { .parser = NULL };
                                     cborFindResult = cbor_value_enter_container(&aceMap, &resources);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering a Resource Array.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering a Resource Array.");
                                     OIC_LOG_V(DEBUG, TAG, "%s entered resources array.", __func__);
                                     int resourceCount = 0;
 
@@ -1767,7 +1767,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                         // rMap is the map of the current Resource being decoded
                                         CborValue rMap = { .parser = NULL  };
                                         cborFindResult = cbor_value_enter_container(&resources, &rMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering Resource Map");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering Resource Map");
                                         resourceCount++;
                                         OIC_LOG_V(DEBUG, TAG, "%s entered resource map for resource #%d.", __func__, resourceCount);
 
@@ -1784,17 +1784,17 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             }
                                             size_t rMapNameLen = 0;
                                             cborFindResult = cbor_value_dup_text_string(&rMap, &rMapName, &rMapNameLen, NULL);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RMap Data Name Tag.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RMap Data Name Tag.");
                                             OIC_LOG_V(DEBUG, TAG, "%s found %s tag in resource #%d map.", __func__, rMapName, resourceCount);
                                             cborFindResult = cbor_value_advance(&rMap);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing RMap Data Value.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing RMap Data Value.");
                                             OIC_LOG_V(DEBUG, TAG, "%s advanced resource map.", __func__);
 
                                             // "href"
                                             if (0 == strcmp(OIC_JSON_HREF_NAME, rMapName))
                                             {
                                                 cborFindResult = cbor_value_dup_text_string(&rMap, &rsrc->href, &tempLen, NULL);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Href Value.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Href Value.");
                                                 OIC_LOG_V(DEBUG, TAG, "%s found href = %s.", __func__, rsrc->href);
                                                 // OCF 1.0 shouldn't use "*" href even though it's supported; instead,
                                                 // use "wc" object.
@@ -1816,7 +1816,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             if (0 == strcmp(OIC_JSON_RT_NAME, rMapName) && cbor_value_is_array(&rMap))
                                             {
                                                 cbor_value_get_array_length(&rMap, &rsrc->typeLen);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RT array length.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RT array length.");
                                                 VERIFY_SUCCESS(TAG, (0 != rsrc->typeLen), ERROR);
 
                                                 rsrc->types = (char**)OICCalloc(rsrc->typeLen, sizeof(char*));
@@ -1824,15 +1824,15 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
 
                                                 CborValue resourceTypes;
                                                 cborFindResult = cbor_value_enter_container(&rMap, &resourceTypes);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering RT Array.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering RT Array.");
 
                                                 for(size_t i = 0; cbor_value_is_valid(&resourceTypes) && cbor_value_is_text_string(&resourceTypes); i++)
                                                 {
                                                     cborFindResult = cbor_value_dup_text_string(&resourceTypes, &(rsrc->types[i]), &readLen, NULL);
-                                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding resource type.");
+                                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding resource type.");
                                                     OIC_LOG_V(DEBUG, TAG, "%s found rt = %s.", __func__, rsrc->types[i]);
                                                     cborFindResult = cbor_value_advance(&resourceTypes);
-                                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing resource type.");
+                                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing resource type.");
                                                 }
                                             }
 
@@ -1840,7 +1840,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             if (0 == strcmp(OIC_JSON_IF_NAME, rMapName) && cbor_value_is_array(&rMap))
                                             {
                                                 cbor_value_get_array_length(&rMap, &rsrc->interfaceLen);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding IF array length.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding IF array length.");
                                                 VERIFY_SUCCESS(TAG, (0 != rsrc->interfaceLen), ERROR);
 
                                                 rsrc->interfaces = (char**)OICCalloc(rsrc->interfaceLen, sizeof(char*));
@@ -1848,15 +1848,15 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
 
                                                 CborValue interfaces;
                                                 cborFindResult = cbor_value_enter_container(&rMap, &interfaces);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering IF Array.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering IF Array.");
 
                                                 for(size_t i = 0; cbor_value_is_valid(&interfaces) && cbor_value_is_text_string(&interfaces); i++)
                                                 {
                                                     cborFindResult = cbor_value_dup_text_string(&interfaces, &(rsrc->interfaces[i]), &readLen, NULL);
-                                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding IF type.");
+                                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding IF type.");
                                                     OIC_LOG_V(DEBUG, TAG, "%s found if = %s.", __func__, rsrc->interfaces[i]);
                                                     cborFindResult = cbor_value_advance(&interfaces);
-                                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing IF type.");
+                                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing IF type.");
                                                 }
                                             }
 
@@ -1864,7 +1864,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             if (0 == strcmp(OIC_JSON_REL_NAME, rMapName))
                                             {
                                                 cborFindResult = cbor_value_dup_text_string(&rMap, &rsrc->rel, &tempLen, NULL);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding REL Value.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding REL Value.");
                                                 OIC_LOG_V(DEBUG, TAG, "%s found rel = %s.", __func__, rsrc->rel);
                                             }
 
@@ -1873,7 +1873,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             {
                                                 char *wc = NULL;
                                                 cborFindResult = cbor_value_dup_text_string(&rMap, &wc, &tempLen, NULL);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding wc Value.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding wc Value.");
                                                 OIC_LOG_V(DEBUG, TAG, "%s found wc = %s.", __func__, wc);
                                                 if (0 == strcmp(OIC_JSON_WC_ASTERISK_NAME, wc))
                                                 {
@@ -1901,7 +1901,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                             if (cbor_value_is_valid(&rMap))
                                             {
                                                 cborFindResult = cbor_value_advance(&rMap);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing rMap.");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing rMap.");
                                                 OIC_LOG_V(DEBUG, TAG, "%s advanced rMap.", __func__);
                                             }
                                         }
@@ -1911,7 +1911,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                         if (cbor_value_is_valid(&resources))
                                         {
                                             cborFindResult = cbor_value_advance(&resources);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Resource Array.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Resource Array.");
                                             OIC_LOG_V(DEBUG, TAG, "%s advanced resources map.", __func__);
                                         }
                                     }
@@ -1922,7 +1922,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                 {
                                     uint64_t tmp64;
                                     cborFindResult = cbor_value_get_uint64(&aceMap, &tmp64);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a PERM Value.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a PERM Value.");
                                     ace->permission = (uint16_t)tmp64;
                                     OIC_LOG_V(DEBUG, TAG, "%s found permission = %d.", __func__, ace->permission);
                                 }
@@ -1935,10 +1935,10 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                     size_t validitySize = 0;
 
                                     cborFindResult = cbor_value_get_array_length(&aceMap, &validitySize);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a Validity Array Length.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a Validity Array Length.");
 
                                     cborFindResult = cbor_value_enter_container(&aceMap, &validitiesMap);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a validity Array Map.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a validity Array Map.");
 
                                     while(cbor_value_is_valid(&validitiesMap))
                                     {
@@ -1949,19 +1949,19 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                         CborValue validityMap  = {.parser = NULL};
                                         //period (string)
                                         cborFindResult = cbor_value_enter_container(&validitiesMap, &validityMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a validity Map.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a validity Map.");
 
                                         size_t vmLen = 0;
                                         cborFindResult =cbor_value_dup_text_string(&validityMap, &validity->period, &vmLen, NULL);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a Period value.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a Period value.");
 
                                         //recurrence (string array)
                                         CborValue recurrenceMap  = {.parser = NULL};
                                         cborFindResult = cbor_value_enter_container(&validityMap, &recurrenceMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a recurrence array.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a recurrence array.");
 
                                         cborFindResult = cbor_value_get_array_length(&recurrenceMap, &validity->recurrenceLen);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Adding Recurrence Array.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Adding Recurrence Array.");
 
                                         validity->recurrences = (char**)OICCalloc(validity->recurrenceLen, sizeof(char*));
                                         VERIFY_NOT_NULL(TAG, validity->recurrences, ERROR);
@@ -1969,14 +1969,14 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                         for(size_t i = 0; cbor_value_is_text_string(&recurrenceMap) && i < validity->recurrenceLen; i++)
                                         {
                                             cborFindResult = cbor_value_dup_text_string(&recurrenceMap, &validity->recurrences[i], &vmLen, NULL);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a recurrence Value.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding a recurrence Value.");
 
                                             cborFindResult = cbor_value_advance(&recurrenceMap);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing a recurrences Array.");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing a recurrences Array.");
                                         }
 
                                         cborFindResult = cbor_value_advance(&validitiesMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing a validities Array.");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing a validities Array.");
                                     }
                                 }
 #ifdef MULTIPLE_OWNER
@@ -1985,7 +1985,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                                 {
                                     char *eowner = NULL;
                                     cborFindResult = cbor_value_dup_text_string(&aceMap, &eowner, &tempLen, NULL);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding eownerId Value.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding eownerId Value.");
                                     if(NULL == ace->eownerID)
                                     {
                                         ace->eownerID = (OicUuid_t*)OICCalloc(1, sizeof(OicUuid_t));
@@ -2003,7 +2003,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                             if (aceMapType != CborMapType && cbor_value_is_valid(&aceMap))
                             {
                                 cborFindResult = cbor_value_advance(&aceMap);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing the Array.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing the Array.");
                                 OIC_LOG_V(DEBUG, TAG, "%s advanced aceMap.", __func__);
                             }
                         } // end decoding ACE/ACE2 object
@@ -2014,7 +2014,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                         if (cbor_value_is_valid(&acesArray))
                         {
                             cborFindResult = cbor_value_advance(&acesArray);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing ACL Array.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing ACL Array.");
                         }
                     } // end ace array while loop
 
@@ -2023,7 +2023,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
                     if (cbor_value_is_valid(&aclistMap))
                     {
                         cborFindResult = cbor_value_advance(&aclistMap);
-                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing ACLIST Map.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing ACLIST Map.");
                         OIC_LOG_V(DEBUG, TAG, "%s advanced aclist map.", __func__);
                     }
 
@@ -2039,7 +2039,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
             {
                 char *stRowner = NULL;
                 cborFindResult = cbor_value_dup_text_string(&aclMap, &stRowner, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Rownerid Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Rownerid Value.");
                 ret = ConvertStrToUuid(stRowner, &acl->rownerID);
                 free(stRowner);
                 VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
@@ -2054,7 +2054,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
         if (cbor_value_is_valid(&aclMap))
         {
             cborFindResult = cbor_value_advance(&aclMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing ACL Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing ACL Map.");
         }
     }
 
index 740f67e..7353e14 100644 (file)
@@ -102,24 +102,24 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl
 
     // Create AMACL Map
     cborEncoderResult = cbor_encoder_create_map(&encoder, &amaclMap, AMACL_MAP_SIZE);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding AMACL Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding AMACL Map.");
 
     // resources -- Mandatory
     cborEncoderResult = cbor_encode_text_string(&amaclMap, OIC_JSON_RESOURCES_NAME,
                 strlen(OIC_JSON_RESOURCES_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding Resource Name Tag.");
 
     cborEncoderResult = cbor_encoder_create_map(&amaclMap, &rsrcMap, AMACL_RSRC_MAP_SIZE);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding Resource Map.");
 
 
     cborEncoderResult = cbor_encode_text_string(&rsrcMap, OIC_JSON_RLIST_NAME,
                 strlen(OIC_JSON_RLIST_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RLIST Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RLIST Name Tag.");
 
     // TODO : Need to input array length by OicSecAmacl_t->resources->rlistLen based on spec.
     cborEncoderResult = cbor_encoder_create_array(&rsrcMap, &rlistArray, amacl->resourcesLen);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RLIST Array.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RLIST Array.");
 
     // TODO : Need to add OicSecAmacl_t->rlist as array rMap based on RAML spec.
     for (size_t i = 0; i < amacl->resourcesLen; i++)
@@ -127,46 +127,46 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl
         // TODO : Need to create rMap structure based on RAML spec.
         CborEncoder rMap;
         cborEncoderResult = cbor_encoder_create_map(&rlistArray, &rMap, AMACL_RLIST_MAP_SIZE);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RLIST Map.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RLIST Map.");
 
         cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_HREF_NAME,
                 strlen(OIC_JSON_HREF_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding HREF Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding HREF Name Tag.");
         cborEncoderResult = cbor_encode_text_string(&rMap, amacl->resources[i],
                 strlen(amacl->resources[i]));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding HREF Value in Map.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding HREF Value in Map.");
 
         cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_RT_NAME,
                 strlen(OIC_JSON_RT_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
 
         // TODO : Need to assign real value of RT
         cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_EMPTY_STRING,
                 strlen(OIC_JSON_EMPTY_STRING));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Value.");
 
         cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_IF_NAME,
                 strlen(OIC_JSON_IF_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
 
         // TODO : Need to assign real value of IF
         cborEncoderResult = cbor_encode_text_string(&rMap, OIC_JSON_EMPTY_STRING,
                 strlen(OIC_JSON_EMPTY_STRING));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Value.");
 
         cborEncoderResult = cbor_encoder_close_container(&rlistArray, &rMap);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RLIST Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RLIST Array.");
     }
 
     cborEncoderResult = cbor_encoder_close_container(&rsrcMap, &rlistArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RLIST Array.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RLIST Array.");
 
 
     cborEncoderResult = cbor_encoder_close_container(&amaclMap, &rsrcMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Resource Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Resource Map.");
 
     cborEncoderResult = cbor_encoder_close_container(&encoder, &amaclMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Amacl Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Amacl Map.");
 
     if (CborNoError == cborEncoderResult)
     {
@@ -226,16 +226,16 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
 
     CborValue amaclMap = { .parser = NULL };
     cborFindResult = cbor_value_enter_container(&amaclCbor, &amaclMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering Amacl Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering Amacl Map.");
 
     while(cbor_value_is_valid(&amaclMap) && cbor_value_is_text_string(&amaclMap))
     {
         char *name = NULL;
         size_t len = 0;
         cborFindResult = cbor_value_dup_text_string(&amaclMap, &name, &len, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Amacl Data Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Amacl Data Name Tag.");
         cborFindResult = cbor_value_advance(&amaclMap);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Amacl Data Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Amacl Data Value.");
 
         //CborType type = cbor_value_get_type(&amaclMap);
 
@@ -245,7 +245,7 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
             // resource map
             CborValue rsrcMap = { .parser = NULL  };
             cborFindResult = cbor_value_enter_container(&amaclMap, &rsrcMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering Resource Map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering Resource Map");
 
             while(cbor_value_is_valid(&rsrcMap) && cbor_value_is_text_string(&rsrcMap))
             {
@@ -253,9 +253,9 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
                 char *rsrcName = NULL;
                 size_t rsrcNameLen = 0;
                 cborFindResult = cbor_value_dup_text_string(&rsrcMap, &rsrcName, &rsrcNameLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Resource Data Name Tag.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Resource Data Name Tag.");
                 cborFindResult = cbor_value_advance(&rsrcMap);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Resource Data Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Resource Data Value.");
 
                 // rlist
                 if (0 == strcmp(OIC_JSON_RLIST_NAME, rsrcName))
@@ -263,13 +263,13 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
                     int i = 0;
                     // TODO : Need to assign array length to OicSecAmacl_t->resources->rlistLen based of RAML spec.
                     cborFindResult = cbor_value_get_array_length(&rsrcMap, &headAmacl->resourcesLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Rlist Array Len.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Rlist Array Len.");
 
                     CborValue rsrcArray = { .parser = NULL  };
 
                     // rlist array
                     cborFindResult = cbor_value_enter_container(&rsrcMap, &rsrcArray);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering Rlist Array");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering Rlist Array");
 
                     // TODO : Need to check data structure of OicSecAmacl_t based on RAML spec.
                     headAmacl->resources = (char **) OICCalloc(headAmacl->resourcesLen, sizeof(*headAmacl->resources));
@@ -280,23 +280,23 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
                         // rMap
                         CborValue rMap = { .parser = NULL  };
                         cborFindResult = cbor_value_enter_container(&rsrcArray, &rMap);
-                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering Rlist Map");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering Rlist Map");
 
                         while(cbor_value_is_valid(&rMap) && cbor_value_is_text_string(&rMap))
                         {
                             char *rMapName = NULL;
                             size_t rMapNameLen = 0;
                             cborFindResult = cbor_value_dup_text_string(&rMap, &rMapName, &rMapNameLen, NULL);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RMap Data Name Tag.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RMap Data Name Tag.");
                             cborFindResult = cbor_value_advance(&rMap);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RMap Data Value.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RMap Data Value.");
 
                             // "href"
                             if (0 == strcmp(OIC_JSON_HREF_NAME, rMapName))
                             {
                                 // TODO : Need to check data structure of OicSecAmacl_t based on RAML spec.
                                 cborFindResult = cbor_value_dup_text_string(&rMap, &headAmacl->resources[i++], &len, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Href Value.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Href Value.");
                             }
 
                             // "rt"
@@ -305,7 +305,7 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
                                 // TODO : Need to check data structure of OicSecAmacl_t and assign based on RAML spec.
                                 char *rtData = NULL;
                                 cborFindResult = cbor_value_dup_text_string(&rMap, &rtData, &len, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding RT Value.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding RT Value.");
                                 OICFree(rtData);
                             }
 
@@ -315,14 +315,14 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
                                 // TODO : Need to check data structure of OicSecAmacl_t and assign based on RAML spec.
                                 char *ifData = NULL;
                                 cborFindResult = cbor_value_dup_text_string(&rMap, &ifData, &len, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding IF Value.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding IF Value.");
                                 OICFree(ifData);
                             }
 
                             if (cbor_value_is_valid(&rMap))
                             {
                                 cborFindResult = cbor_value_advance(&rMap);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Rlist Map.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Rlist Map.");
                             }
                             OICFree(rMapName);
                         }
@@ -330,7 +330,7 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
                         if (cbor_value_is_valid(&rsrcArray))
                         {
                             cborFindResult = cbor_value_advance(&rsrcArray);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Resource Array.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Resource Array.");
                         }
                     }
                 }
@@ -338,7 +338,7 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
                 if (cbor_value_is_valid(&rsrcMap))
                 {
                     cborFindResult = cbor_value_advance(&rsrcMap);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Resource Map.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Resource Map.");
                 }
                 OICFree(rsrcName);
             }
index 5e77c09..94cd79e 100644 (file)
@@ -389,14 +389,14 @@ static CborError SerializeEncodingToCborInternal(CborEncoder *map, const OicSecK
     {
         cborEncoderResult = cbor_encode_text_string(map, OIC_JSON_ENCODING_NAME,
             strlen(OIC_JSON_ENCODING_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Encoding Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Encoding Tag.");
         cborEncoderResult = cbor_encode_text_string(map, encoding,
             strlen(encoding));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Encoding Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Encoding Value.");
 
         cborEncoderResult = cbor_encode_text_string(map, OIC_JSON_DATA_NAME,
             strlen(OIC_JSON_DATA_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Name Tag.");
         if (OIC_ENCODING_DER == value->encoding ||
             OIC_ENCODING_RAW == value->encoding)
         {
@@ -408,7 +408,7 @@ static CborError SerializeEncodingToCborInternal(CborEncoder *map, const OicSecK
             cborEncoderResult = cbor_encode_text_string(map,
                     (char*)value->data, value->len);
         }
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Name Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Name Value.");
     }
     else
     {
@@ -426,16 +426,16 @@ CborError SerializeEncodingToCbor(CborEncoder *rootMap, const char* tag, const O
     const size_t mapSize = 2;
 
     cborEncoderResult = cbor_encode_text_string(rootMap, tag, strlen(tag));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PrivateData Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PrivateData Tag.");
 
     cborEncoderResult = cbor_encoder_create_map(rootMap, &map, mapSize);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Map");
 
     cborEncoderResult = SerializeEncodingToCborInternal(&map, value);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding OicSecKey_t structure");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding OicSecKey_t structure");
 
     cborEncoderResult = cbor_encoder_close_container(rootMap, &map);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Map.");
 
     exit:
     return cborEncoderResult;
@@ -448,10 +448,10 @@ CborError SerializeSecOptToCbor(CborEncoder *rootMap, const char* tag, const Oic
     const size_t mapSize = 3;
 
     cborEncoderResult = cbor_encode_text_string(rootMap, tag, strlen(tag));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PrivateData Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PrivateData Tag.");
 
     cborEncoderResult = cbor_encoder_create_map(rootMap, &map, mapSize);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Map");
 
     OicSecKey_t in;
     in.data = value->data;
@@ -459,16 +459,16 @@ CborError SerializeSecOptToCbor(CborEncoder *rootMap, const char* tag, const Oic
     in.len = value->len;
 
     cborEncoderResult = SerializeEncodingToCborInternal(&map, &in);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding OicSecKey_t structure");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding OicSecKey_t structure");
 
     cborEncoderResult = cbor_encode_text_string(&map, OIC_JSON_REVOCATION_STATUS_NAME,
         strlen(OIC_JSON_REVOCATION_STATUS_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding optional revstat Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding optional revstat Tag.");
     cborEncoderResult = cbor_encode_boolean(&map, value->revstat);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding optional revstat Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding optional revstat Value.");
 
     cborEncoderResult = cbor_encoder_close_container(rootMap, &map);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Map.");
 
     exit:
     return cborEncoderResult;
@@ -497,7 +497,7 @@ static CborError DeserializeEncodingFromCborInternal(CborValue *map, char *name,
             cborFindResult = CborErrorUnknownType;
             OIC_LOG(ERROR, TAG, "Unknown type for private data.");
         }
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding PrivateData.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding PrivateData.");
     }
 
     // encoding -- Mandatory
@@ -505,7 +505,7 @@ static CborError DeserializeEncodingFromCborInternal(CborValue *map, char *name,
     {
         char* strEncoding = NULL;
         cborFindResult = cbor_value_dup_text_string(map, &strEncoding, &len, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding EncodingType");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding EncodingType");
 
         if(strcmp(strEncoding, OIC_SEC_ENCODING_RAW) == 0)
         {
@@ -549,19 +549,19 @@ CborError DeserializeEncodingFromCbor(CborValue *rootMap, OicSecKey_t *value)
         if (type == CborTextStringType && cbor_value_is_text_string(&map))
         {
             cborFindResult = cbor_value_dup_text_string(&map, &name, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to get text");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to get text");
             cborFindResult = cbor_value_advance(&map);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to advance value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to advance value");
         }
         if (name)
         {
             cborFindResult = DeserializeEncodingFromCborInternal(&map, name, value);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to read OicSecKey_t value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to read OicSecKey_t value");
         }
         if (cbor_value_is_valid(&map))
         {
             cborFindResult = cbor_value_advance(&map);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Map.");
         }
         //Because cbor using malloc directly, it is required to use free() instead of OICFree
         free(name);
@@ -584,9 +584,9 @@ CborError DeserializeSecOptFromCbor(CborValue *rootMap, OicSecOpt_t *value)
         if (type == CborTextStringType && cbor_value_is_text_string(&map))
         {
             cborFindResult = cbor_value_dup_text_string(&map, &name, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to get text");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to get text");
             cborFindResult = cbor_value_advance(&map);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to advance value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to advance value");
         }
         if (name)
         {
@@ -594,11 +594,11 @@ CborError DeserializeSecOptFromCbor(CborValue *rootMap, OicSecOpt_t *value)
             if (strcmp(name, OIC_JSON_REVOCATION_STATUS_NAME) == 0)
             {
                 cborFindResult = cbor_value_get_boolean(&map, &value->revstat);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding revstat Value.")
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding revstat Value.")
             }
             OicSecKey_t out;
             cborFindResult = DeserializeEncodingFromCborInternal(&map, name, &out);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to read OicSecKey_t value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to read OicSecKey_t value");
 
             value->data = out.data;
             value->encoding = out.encoding;
@@ -607,7 +607,7 @@ CborError DeserializeSecOptFromCbor(CborValue *rootMap, OicSecOpt_t *value)
         if (cbor_value_is_valid(&map))
         {
             cborFindResult = cbor_value_advance(&map);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Map.");
         }
         //Because cbor using malloc directly, it is required to use free() instead of OICFree
         free(name);
@@ -703,16 +703,16 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
 
     // Create CRED Root Map (creds, rownerid)
     cborEncoderResult = cbor_encoder_create_map(&encoder, &credRootMap, credRootMapSize);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Root Map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Root Map");
 
     // creds
     cborEncoderResult = cbor_encode_text_string(&credRootMap, OIC_JSON_CREDS_NAME,
         strlen(OIC_JSON_CREDS_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding creds Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding creds Name Tag.");
 
     // creds array
     cborEncoderResult = cbor_encoder_create_array(&credRootMap, &credArray, OicSecCredCount(cred));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Array.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Array.");
 
     while (cred)
     {
@@ -755,26 +755,26 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
             mapSize++;
         }
         cborEncoderResult = cbor_encoder_create_map(&credArray, &credMap, mapSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Map");
 
         //CredID -- Mandatory
         cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_CREDID_NAME,
             strlen(OIC_JSON_CREDID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Id Tag. ");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Id Tag. ");
         cborEncoderResult = cbor_encode_int(&credMap, cred->credId);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Id Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Id Value.");
 
         //Subject -- Mandatory
         cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_SUBJECTID_NAME,
             strlen(OIC_JSON_SUBJECTID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Subject Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Subject Tag.");
         inLen = (memcmp(&(cred->subject), &WILDCARD_SUBJECT_ID, sizeof(OicUuid_t)) == 0) ?
             WILDCARD_SUBJECT_ID_LEN : sizeof(OicUuid_t);
         if(inLen == WILDCARD_SUBJECT_ID_LEN)
         {
             cborEncoderResult = cbor_encode_text_string(&credMap, WILDCARD_RESOURCE_URI,
                 strlen(WILDCARD_RESOURCE_URI));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Subject Id wildcard Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding Subject Id wildcard Value.");
         }
         else
         {
@@ -782,7 +782,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
             ret = ConvertUuidToStr(&cred->subject, &subject);
             VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
             cborEncoderResult = cbor_encode_text_string(&credMap, subject, strlen(subject));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Subject Id Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding Subject Id Value.");
             OICFree(subject);
         }
 
@@ -791,38 +791,38 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
         {
             cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_ROLEID_NAME,
                 strlen(OIC_JSON_ROLEID_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding role ID map tag");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding role ID map tag");
 
             bool includeAuthority = (0 != memcmp(&cred->roleId.authority, &EMPTY_ROLE.authority, sizeof(EMPTY_ROLE.authority)));
 
             cborEncoderResult = cbor_encoder_create_map(&credMap, &roleIdMap, ROLEID_MAP_SIZE + (includeAuthority ? 1 : 0));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding role ID map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding role ID map");
 
             cborEncoderResult = cbor_encode_text_string(&roleIdMap, OIC_JSON_ROLE_NAME, strlen(OIC_JSON_ROLE_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding role tag");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding role tag");
 
             cborEncoderResult = cbor_encode_text_string(&roleIdMap, cred->roleId.id, strlen(cred->roleId.id));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding role value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding role value");
 
             if (includeAuthority)
             {
                 cborEncoderResult = cbor_encode_text_string(&roleIdMap, OIC_JSON_AUTHORITY_NAME, strlen(OIC_JSON_AUTHORITY_NAME));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding authority tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding authority tag");
 
                 cborEncoderResult = cbor_encode_text_string(&roleIdMap, cred->roleId.authority, strlen(cred->roleId.authority));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding authority value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding authority value");
             }
 
             cborEncoderResult = cbor_encoder_close_container(&credMap, &roleIdMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing role ID map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing role ID map");
         }
 
         //CredType -- Mandatory
         cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_CREDTYPE_NAME,
             strlen(OIC_JSON_CREDTYPE_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Type Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Type Tag.");
         cborEncoderResult = cbor_encode_int(&credMap, cred->credType);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Type Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Type Value.");
 
 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
         //PublicData -- Not Mandatory
@@ -831,24 +831,24 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
         {
             cborEncoderResult = SerializeEncodingToCbor(&credMap,
                                          OIC_JSON_PUBLICDATA_NAME, &cred->publicData);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PublicData Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PublicData Tag.");
         }
         //OptionalData -- Not Mandatory
         if (SIGNED_ASYMMETRIC_KEY == cred->credType && cred->optionalData.data)
         {
             cborEncoderResult = SerializeSecOptToCbor(&credMap,
                                          OIC_JSON_OPTDATA_NAME, &cred->optionalData);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding OptionalData Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding OptionalData Tag.");
         }
         //CredUsage -- Not Mandatory
         if(cred->credUsage)
         {
             cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_CREDUSAGE_NAME,
                 strlen(OIC_JSON_CREDUSAGE_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Credusage Name Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Credusage Name Tag.");
             cborEncoderResult = cbor_encode_text_string(&credMap, cred->credUsage,
                 strlen(cred->credUsage));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Credusage Name Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Credusage Name Value.");
         }
 #endif /* __WITH_DTLS__ ||  __WITH_TLS__*/
         //PrivateData -- Not Mandatory
@@ -856,7 +856,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
         {
             cborEncoderResult = SerializeEncodingToCbor(&credMap,
                                          OIC_JSON_PRIVATEDATA_NAME, &cred->privateData);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PrivateData Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PrivateData Tag.");
         }
 
         //Period -- Not Mandatory
@@ -864,10 +864,10 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
         {
             cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PERIOD_NAME,
                 strlen(OIC_JSON_PERIOD_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Period Name Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Period Name Tag.");
             cborEncoderResult = cbor_encode_text_string(&credMap, cred->period,
                 strlen(cred->period));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Period Name Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Period Name Value.");
         }
 
 #ifdef MULTIPLE_OWNER
@@ -877,22 +877,22 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
             char *eowner = NULL;
             cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_EOWNERID_NAME,
                 strlen(OIC_JSON_EOWNERID_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding eownerId Name Tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding eownerId Name Tag.");
             ret = ConvertUuidToStr(cred->eownerID, &eowner);
             VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
             cborEncoderResult = cbor_encode_text_string(&credMap, eowner, strlen(eowner));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding eownerId Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding eownerId Value.");
             OICFree(eowner);
         }
 #endif //MULTIPLE_OWNER
 
         cborEncoderResult = cbor_encoder_close_container(&credArray, &credMap);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Cred Map.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Cred Map.");
 
         cred = cred->next;
     }
     cborEncoderResult = cbor_encoder_close_container(&credRootMap, &credArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Cred Array.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Cred Array.");
 
     cred = credS;
 
@@ -901,11 +901,11 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
         char *rowner = NULL;
         cborEncoderResult = cbor_encode_text_string(&credRootMap, OIC_JSON_ROWNERID_NAME,
             strlen(OIC_JSON_ROWNERID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding rownerid Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding rownerid Name.");
         ret = ConvertUuidToStr(&gRownerId, &rowner);
         VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
         cborEncoderResult = cbor_encode_text_string(&credRootMap, rowner, strlen(rowner));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding rownerid Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding rownerid Value.");
         OICFree(rowner);
     }
 
@@ -914,38 +914,38 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
         CborEncoder rtArray;
         cborEncoderResult = cbor_encode_text_string(&credRootMap, OIC_JSON_RT_NAME,
                 strlen(OIC_JSON_RT_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
         cborEncoderResult = cbor_encoder_create_array(&credRootMap, &rtArray, 1);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Value.");
         for (size_t i = 0; i < 1; i++)
         {
             cborEncoderResult = cbor_encode_text_string(&rtArray, OIC_RSRC_TYPE_SEC_CRED,
                     strlen(OIC_RSRC_TYPE_SEC_CRED));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
         }
         cborEncoderResult = cbor_encoder_close_container(&credRootMap, &rtArray);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RT.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RT.");
 
         //IF-- Mandatory
         CborEncoder ifArray;
         cborEncoderResult = cbor_encode_text_string(&credRootMap, OIC_JSON_IF_NAME,
                  strlen(OIC_JSON_IF_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
         cborEncoderResult = cbor_encoder_create_array(&credRootMap, &ifArray, 1);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Value.");
         for (size_t i = 0; i < 1; i++)
         {
             cborEncoderResult = cbor_encode_text_string(&ifArray, OC_RSRVD_INTERFACE_DEFAULT,
                     strlen(OC_RSRVD_INTERFACE_DEFAULT));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
         }
         cborEncoderResult = cbor_encoder_close_container(&credRootMap, &ifArray);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing IF.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing IF.");
     }
 
     // Close CRED Root Map
     cborEncoderResult = cbor_encoder_close_container(&encoder, &credRootMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing CRED Root Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing CRED Root Map.");
 
     if (CborNoError == cborEncoderResult)
     {
@@ -1010,7 +1010,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
     // Enter CRED Root Map
     CborValue CredRootMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
     cborFindResult = cbor_value_enter_container(&credCbor, &CredRootMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering CRED Root Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering CRED Root Map.");
 
     headCred = (OicSecCred_t *) OICCalloc(1, sizeof(OicSecCred_t));
     VERIFY_NOT_NULL(TAG, headCred, ERROR);
@@ -1022,9 +1022,9 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
         if (type == CborTextStringType && cbor_value_is_text_string(&CredRootMap))
         {
             cborFindResult = cbor_value_dup_text_string(&CredRootMap, &tagName, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Name in CRED Root Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Name in CRED Root Map.");
             cborFindResult = cbor_value_advance(&CredRootMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Value in CRED Root Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Value in CRED Root Map.");
         }
         if(tagName)
         {
@@ -1035,7 +1035,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                 int credCount = 0;
                 CborValue credArray = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
                 cborFindResult = cbor_value_enter_container(&CredRootMap, &credArray);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Cred Array.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Cred Array.");
 
                 while (cbor_value_is_valid(&credArray))
                 {
@@ -1043,7 +1043,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                     //CredId -- Mandatory
                     CborValue credMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
                     cborFindResult = cbor_value_enter_container(&credArray, &credMap);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Cred Map.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Cred Map.");
                     OicSecCred_t *cred = NULL;
 
                     if(1 == credCount)
@@ -1068,9 +1068,9 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                         if (cmType == CborTextStringType)
                         {
                             cborFindResult = cbor_value_dup_text_string(&credMap, &name, &tempLen, NULL);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Name in CRED Map.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Name in CRED Map.");
                             cborFindResult = cbor_value_advance(&credMap);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Value in CRED Map.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Value in CRED Map.");
                         }
                         if(name)
                         {
@@ -1079,7 +1079,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                             {
                                 uint64_t credId = 0;
                                 cborFindResult = cbor_value_get_uint64(&credMap, &credId);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CredId.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding CredId.");
                                 cred->credId = (uint16_t)credId;
                             }
                             // subjectid
@@ -1087,7 +1087,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                             {
                                 char *subjectid = NULL;
                                 cborFindResult = cbor_value_dup_text_string(&credMap, &subjectid, &tempLen, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding subjectid Value.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding subjectid Value.");
                                 if(strcmp(subjectid, WILDCARD_RESOURCE_URI) == 0)
                                 {
                                     cred->subject.id[0] = '*';
@@ -1110,14 +1110,14 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                                 memset(&roleIdMap, 0, sizeof(roleIdMap));
 
                                 cborFindResult = cbor_value_enter_container(&credMap, &roleIdMap);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed entering role ID map");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed entering role ID map");
 
                                 while (cbor_value_is_valid(&roleIdMap) && cbor_value_is_text_string(&roleIdMap))
                                 {
                                     cborFindResult = cbor_value_dup_text_string(&roleIdMap, &roleIdTagName, &unusedLen, NULL);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting role ID map tag name");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting role ID map tag name");
                                     cborFindResult = cbor_value_advance(&roleIdMap);
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing role ID map");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing role ID map");
 
                                     if (NULL != roleIdTagName)
                                     {
@@ -1125,12 +1125,12 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                                         {
                                             char *roleId = NULL;
                                             cborFindResult = cbor_value_dup_text_string(&roleIdMap, &roleId, &unusedLen, NULL);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting role id value");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting role id value");
                                             if (strlen(roleId) >= sizeof(cred->roleId.id))
                                             {
                                                 cborFindResult = CborUnknownError;
                                                 free(roleId);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Role ID is too long");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Role ID is too long");
                                             }
                                             OICStrcpy(cred->roleId.id, sizeof(cred->roleId.id), roleId);
                                             free(roleId);
@@ -1139,12 +1139,12 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                                         {
                                             char *authorityName = NULL;
                                             cborFindResult = cbor_value_dup_text_string(&roleIdMap, &authorityName, &unusedLen, NULL);
-                                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting role authority value");
+                                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting role authority value");
                                             if (strlen(authorityName) >= sizeof(cred->roleId.authority))
                                             {
                                                 cborFindResult = CborUnknownError;
                                                 free(authorityName);
-                                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Authority name is too long");
+                                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Authority name is too long");
                                             }
                                             OICStrcpy(cred->roleId.authority, sizeof(cred->roleId.authority), authorityName);
                                             free(authorityName);
@@ -1161,7 +1161,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                                     if (cbor_value_is_valid(&roleIdMap))
                                     {
                                         cborFindResult = cbor_value_advance(&roleIdMap);
-                                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing role map");
+                                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing role map");
                                     }
                                 }
 
@@ -1169,7 +1169,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                                 if ('\0' == cred->roleId.id[0])
                                 {
                                     cborFindResult = CborUnknownError;
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "ID for role was not present in role map");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "ID for role was not present in role map");
                                 }
                             }
                             // credtype
@@ -1177,40 +1177,40 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                             {
                                 uint64_t credType = 0;
                                 cborFindResult = cbor_value_get_uint64(&credMap, &credType);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CredType.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding CredType.");
                                 cred->credType = (OicSecCredType_t)credType;
                             }
                             // privatedata
                             if (strcmp(name, OIC_JSON_PRIVATEDATA_NAME)  == 0)
                             {
                                 cborFindResult = DeserializeEncodingFromCbor(&credMap, &cred->privateData);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to read privateData structure");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to read privateData structure");
                             }
 #if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
                             //PublicData -- Not Mandatory
                             if (strcmp(name, OIC_JSON_PUBLICDATA_NAME)  == 0)
                             {
                                 cborFindResult = DeserializeEncodingFromCbor(&credMap, &cred->publicData);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to read publicData structure");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to read publicData structure");
                             }
                             //OptionalData -- Not Mandatory
                             if (strcmp(name, OIC_JSON_OPTDATA_NAME)  == 0)
                             {
                                 cborFindResult = DeserializeSecOptFromCbor(&credMap, &cred->optionalData);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to read optionalData structure");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to read optionalData structure");
                             }
                             //Credusage -- Not Mandatory
                             if (0 == strcmp(OIC_JSON_CREDUSAGE_NAME, name))
                             {
                                 cborFindResult = cbor_value_dup_text_string(&credMap, &cred->credUsage, &tempLen, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Period.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Period.");
                             }
 #endif  //__WITH_DTLS__ ||  __WITH_TLS__
 
                             if (0 == strcmp(OIC_JSON_PERIOD_NAME, name))
                             {
                                 cborFindResult = cbor_value_dup_text_string(&credMap, &cred->period, &tempLen, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Period.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Period.");
                             }
 
 #ifdef MULTIPLE_OWNER
@@ -1219,7 +1219,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                             {
                                 char *eowner = NULL;
                                 cborFindResult = cbor_value_dup_text_string(&credMap, &eowner, &tempLen, NULL);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding eownerId Value.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding eownerId Value.");
                                 if(NULL == cred->eownerID)
                                 {
                                     cred->eownerID = (OicUuid_t*)OICCalloc(1, sizeof(OicUuid_t));
@@ -1236,7 +1236,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                             if (cbor_value_is_valid(&credMap))
                             {
                                 cborFindResult = cbor_value_advance(&credMap);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing CRED Map.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing CRED Map.");
                             }
                             //Because cbor using malloc directly
                             //It is required to use free() instead of OICFree
@@ -1248,7 +1248,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
                     if (cbor_value_is_valid(&credArray))
                     {
                         cborFindResult = cbor_value_advance(&credArray);
-                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing CRED Array.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing CRED Array.");
                     }
                 }
             }
@@ -1258,7 +1258,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
             {
                 char *stRowner = NULL;
                 cborFindResult = cbor_value_dup_text_string(&CredRootMap, &stRowner, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Rownerid Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Rownerid Value.");
                 *rownerid = (OicUuid_t *) OICCalloc(1, sizeof(OicUuid_t));
                 VERIFY_NOT_NULL(TAG, *rownerid, ERROR);
                 ret = ConvertStrToUuid(stRowner, *rownerid);
@@ -1275,7 +1275,7 @@ OCStackResult CBORPayloadToCred(const uint8_t *cborPayload, size_t size,
         if (cbor_value_is_valid(&CredRootMap))
         {
             cborFindResult = cbor_value_advance(&CredRootMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing CRED Root Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing CRED Root Map.");
         }
     }
 
index a7f7742..1364fef 100644 (file)
@@ -138,10 +138,10 @@ static CborError setCrlData(CborEncoder *out, const char *name, const OicSecKey_
     VERIFY_SUCCESS(TAG, (B64_OK == b64result), ERROR);
 
     result = cbor_encode_text_string(out, name, strlen(name));
-    VERIFY_CBOR_SUCCESS(TAG, result, "Failed Adding name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, result, "Failed Adding name Tag.");
 
     result = cbor_encode_text_string(out, (const char *)encodeBuffer, len);
-    VERIFY_CBOR_SUCCESS(TAG, result, "Failed Adding data Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, result, "Failed Adding data Tag.");
 
 exit:
     OICFree(encodeBuffer);
@@ -167,7 +167,7 @@ static CborError getCrlData(CborValue *in, const char *name, OicSecKey_t *value)
     {
         result = cbor_value_dup_text_string(&crlNode,
                 (char **)&decodeBuffer, &decodeBufferSize, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, result, "Failed Advancing Byte Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, result, "Failed Advancing Byte Array.");
 
         value->len = B64DECODE_OUT_SAFESIZE(decodeBufferSize + 1);
         value->data = OICCalloc(1, value->len);
@@ -224,65 +224,65 @@ OCStackResult CrlToCBORPayload(const OicSecCrl_t *crl, uint8_t **payload, size_t
     cbor_encoder_init(&encoder, outPayload, cborLen, 0);
 
     cborEncoderResult = cbor_encoder_create_map(&encoder, &crlMap, mapSize);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to create CRL Map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to create CRL Map");
 
     //CRLId -- Mandatory
     cborEncoderResult = cbor_encode_text_string(&crlMap, OC_RSRVD_CRL_ID,
         strlen(OC_RSRVD_CRL_ID));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add CRL ID");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add CRL ID");
     cborEncoderResult = cbor_encode_int(&crlMap, crl->CrlId);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add CRL Id value");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add CRL Id value");
 
     //ThisUpdate -- Mandatory
     cborEncoderResult = cbor_encode_text_string(&crlMap, OC_RSRVD_THIS_UPDATE,
         strlen(OC_RSRVD_THIS_UPDATE));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add Crl update");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add Crl update");
     cborEncoderResult = cbor_encode_text_string(&crlMap, (const char *)crl->ThisUpdate.data,
                                                 crl->ThisUpdate.len);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add Crl Update value");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add Crl Update value");
 
     //CRLData -- Mandatory
     cborEncoderResult = setCrlData(&crlMap, OC_RSRVD_CRL, &crl->CrlData);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add CRLData object");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add CRLData object");
 
     //lastUpdate - internal field
     if (lastUpdate)
     {
         cborEncoderResult = cbor_encode_text_string(&crlMap, OC_RSRVD_LAST_UPDATE,
             strlen(OC_RSRVD_LAST_UPDATE));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add last Update tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add last Update tag");
         cborEncoderResult = cbor_encode_text_string(&crlMap, lastUpdate, strlen(lastUpdate));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add last Update value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add last Update value");
     }
 
     //RT -- Mandatory
     CborEncoder rtArray;
     cborEncoderResult = cbor_encode_text_string(&crlMap, OIC_JSON_RT_NAME,
             strlen(OIC_JSON_RT_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&crlMap, &rtArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Value.");
     cborEncoderResult = cbor_encode_text_string(&rtArray, OIC_RSRC_TYPE_SEC_CRL,
             strlen(OIC_RSRC_TYPE_SEC_CRL));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
     cborEncoderResult = cbor_encoder_close_container(&crlMap, &rtArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RT.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RT.");
 
     //IF-- Mandatory
     CborEncoder ifArray;
     cborEncoderResult = cbor_encode_text_string(&crlMap, OIC_JSON_IF_NAME,
        strlen(OIC_JSON_IF_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&crlMap, &ifArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Value.");
     cborEncoderResult = cbor_encode_text_string(&ifArray, OC_RSRVD_INTERFACE_DEFAULT,
             strlen(OC_RSRVD_INTERFACE_DEFAULT));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
     cborEncoderResult = cbor_encoder_close_container(&crlMap, &ifArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing IF.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing IF.");
 
     cborEncoderResult = cbor_encoder_close_container(&encoder, &crlMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add close Crl map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed to add close Crl map");
 
     *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
     *payload = outPayload;
@@ -336,7 +336,7 @@ OCStackResult CBORPayloadToCrl(const uint8_t *cborPayload, const size_t size,
     cbor_parser_init(cborPayload, size, 0, &parser, &crlCbor);
     CborValue crlMap = { .parser = NULL};
     cborFindResult = cbor_value_enter_container(&crlCbor, &crlMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to enter Crl map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to enter Crl map");
 
     crl = (OicSecCrl_t *)OICCalloc(1, sizeof(OicSecCrl_t));
     VERIFY_NOT_NULL(TAG, crl, ERROR);
@@ -347,7 +347,7 @@ OCStackResult CBORPayloadToCrl(const uint8_t *cborPayload, const size_t size,
         int CrlId;
 
         cborFindResult = cbor_value_get_int(&crlMap, &CrlId);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CrlId.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding CrlId.");
         crl->CrlId = (uint16_t)CrlId;
     }
 
@@ -356,11 +356,11 @@ OCStackResult CBORPayloadToCrl(const uint8_t *cborPayload, const size_t size,
     {
         cborFindResult = cbor_value_dup_text_string(&crlMap,
                 (char **)&crl->ThisUpdate.data, &crl->ThisUpdate.len, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Byte Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing Byte Array.");
     }
 
     cborFindResult = getCrlData(&crlCbor, OC_RSRVD_CRL, &crl->CrlData);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to read CRL.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to read CRL.");
 
     OIC_LOG_CRL(INFO, crl);
 
index ba1112c..a032513 100644 (file)
@@ -150,57 +150,57 @@ static OCStackResult CSRToCBORPayload(const uint8_t *csr, size_t csrLen, OicEnco
 
     // Create CSR Root Map (csr)
     cborEncoderResult = cbor_encoder_create_map(&encoder, &csrRootMap, CSR_MAP_SIZE);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CSR Root Map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CSR Root Map");
 
     // Create CSR string entry
     cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_CSR_NAME, strlen(OIC_JSON_CSR_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding CSR name.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding CSR name.");
     cborEncoderResult = cbor_encode_byte_string(&csrRootMap, csr, csrLen);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding CSR value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding CSR value.");
 
     // Create encoding entry
     cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_ENCODING_NAME, strlen(OIC_JSON_ENCODING_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding encoding name.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding encoding name.");
     strEncoding = EncodingValueToString(encoding);
     assert(strEncoding != NULL);
     cborEncoderResult = cbor_encode_text_string(&csrRootMap, strEncoding, strlen(strEncoding));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding encoding value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding encoding value.");
 
     //RT -- Mandatory
     CborEncoder rtArray;
     cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_RT_NAME,
         strlen(OIC_JSON_RT_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&csrRootMap, &rtArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&rtArray, OIC_RSRC_TYPE_SEC_CSR,
             strlen(OIC_RSRC_TYPE_SEC_CSR));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
     }
     cborEncoderResult = cbor_encoder_close_container(&csrRootMap, &rtArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RT.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RT.");
 
     //IF-- Mandatory
     CborEncoder ifArray;
     cborEncoderResult = cbor_encode_text_string(&csrRootMap, OIC_JSON_IF_NAME,
         strlen(OIC_JSON_IF_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&csrRootMap, &ifArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&ifArray, OC_RSRVD_INTERFACE_DEFAULT,
             strlen(OC_RSRVD_INTERFACE_DEFAULT));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
     }
     cborEncoderResult = cbor_encoder_close_container(&csrRootMap, &ifArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing IF.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing IF.");
 
     // Close CSR Map
     cborEncoderResult = cbor_encoder_close_container(&encoder, &csrRootMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing CSR root Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing CSR root Map.");
 
     if (CborNoError == cborEncoderResult)
     {
@@ -252,7 +252,7 @@ OCStackResult CBORPayloadToCSR(const uint8_t *cborPayload, size_t size, uint8_t
     size_t len = 0;
 
     cborFindResult = cbor_parser_init(cborPayload, size, 0, &parser, &csrCbor);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to initialize parser.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to initialize parser.");
 
     if (!cbor_value_is_container(&csrCbor))
     {
@@ -262,7 +262,7 @@ OCStackResult CBORPayloadToCSR(const uint8_t *cborPayload, size_t size, uint8_t
     // Enter CSR Root Map
     CborValue csrRootMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
     cborFindResult = cbor_value_enter_container(&csrCbor, &csrRootMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering CSR Root Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering CSR Root Map.");
 
     while (cbor_value_is_valid(&csrRootMap))
     {
@@ -276,16 +276,16 @@ OCStackResult CBORPayloadToCSR(const uint8_t *cborPayload, size_t size, uint8_t
         if (type == CborTextStringType && cbor_value_is_text_string(&csrRootMap))
         {
             cborFindResult = cbor_value_dup_text_string(&csrRootMap, &tagName, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed finding name in CSR Root Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed finding name in CSR Root Map.");
             cborFindResult = cbor_value_advance(&csrRootMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing value in CSR Root Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing value in CSR Root Map.");
         }
         if (NULL != tagName)
         {
             if (strcmp(tagName, OIC_JSON_CSR_NAME) == 0 && cbor_value_is_byte_string(&csrRootMap))
             {
                 cborFindResult = cbor_value_dup_byte_string(&csrRootMap, &cborCsr, &cborCsrLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed finding name in CSR Map");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed finding name in CSR Map");
                 // Use our own heap allocator and copy the result in so callers can use OICFree.
                 *csr = (uint8_t *)OICCalloc(1, cborCsrLen);
                 VERIFY_NOT_NULL(TAG, *csr, ERROR);
@@ -299,7 +299,7 @@ OCStackResult CBORPayloadToCSR(const uint8_t *cborPayload, size_t size, uint8_t
             {
                 char *strEncoding = NULL;
                 cborFindResult = cbor_value_dup_text_string(&csrRootMap, &strEncoding, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed finding encoding type");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed finding encoding type");
 
                 if (strcmp(strEncoding, OIC_SEC_ENCODING_DER) == 0)
                 {
@@ -329,7 +329,7 @@ OCStackResult CBORPayloadToCSR(const uint8_t *cborPayload, size_t size, uint8_t
         if (cbor_value_is_valid(&csrRootMap))
         {
             cborFindResult = cbor_value_advance(&csrRootMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing CSR Root Map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing CSR Root Map");
         }
     }
 
index cfaa327..957fd5f 100644 (file)
@@ -214,7 +214,7 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
     cbor_encoder_init(&encoder, outPayload, cborLen, 0);
 
     cborEncoderResult = cbor_encoder_create_map(&encoder, &doxmMap, CborIndefiniteLength);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Doxm Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Doxm Map.");
 
     // oxms Property
     if (propertiesToInclude[DOXM_OXMS] && doxm->oxmLen > 0)
@@ -223,17 +223,17 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         CborEncoder oxm;
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXMS_NAME,
             strlen(OIC_JSON_OXMS_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxms Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding oxms Tag.");
         cborEncoderResult = cbor_encoder_create_array(&doxmMap, &oxm, doxm->oxmLen);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxms Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding oxms Array.");
 
         for (size_t i = 0; i < doxm->oxmLen; i++)
         {
             cborEncoderResult = cbor_encode_int(&oxm, doxm->oxm[i]);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxms Value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding oxms Value");
         }
         cborEncoderResult = cbor_encoder_close_container(&doxmMap, &oxm);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing oxms.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing oxms.");
     }
 
     // oxmsel Property
@@ -242,9 +242,9 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         OIC_LOG_V(DEBUG, TAG, "%s: including %s Property.", __func__, OIC_JSON_OXM_SEL_NAME);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXM_SEL_NAME,
             strlen(OIC_JSON_OXM_SEL_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmsel Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding oxmsel Tag.");
         cborEncoderResult = cbor_encode_int(&doxmMap, doxm->oxmSel);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmsel Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding oxmsel Value.");
     }
 
     // sct Property
@@ -253,9 +253,9 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         OIC_LOG_V(DEBUG, TAG, "%s: including %s Property.", __func__, OIC_JSON_SUPPORTED_CRED_TYPE_NAME);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_SUPPORTED_CRED_TYPE_NAME,
             strlen(OIC_JSON_SUPPORTED_CRED_TYPE_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding sct Tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding sct Tag");
         cborEncoderResult = cbor_encode_int(&doxmMap, doxm->sct);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding sct Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding sct Value.");
     }
 
     // owned Property
@@ -264,9 +264,9 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         OIC_LOG_V(DEBUG, TAG, "%s: including %s Property.", __func__, OIC_JSON_OWNED_NAME);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OWNED_NAME,
             strlen(OIC_JSON_OWNED_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding owned Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding owned Tag.");
         cborEncoderResult = cbor_encode_boolean(&doxmMap, doxm->owned);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding owned Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding owned Value.");
     }
 
     // deviceuuid Property
@@ -275,11 +275,11 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         OIC_LOG_V(DEBUG, TAG, "%s: including %s Property.", __func__, OIC_JSON_DEVICE_ID_NAME);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_DEVICE_ID_NAME,
             strlen(OIC_JSON_DEVICE_ID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding deviceuuid Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding deviceuuid Tag.");
         ret = ConvertUuidToStr(&doxm->deviceID, &strUuid);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret , ERROR);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, strUuid, strlen(strUuid));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding deviceuuid Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding deviceuuid Value.");
         OICFree(strUuid);
         strUuid = NULL;
     }
@@ -299,9 +299,9 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         CborEncoder subOwners;
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_SUBOWNERID_NAME,
             strlen(OIC_JSON_SUBOWNERID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SubOwnerId Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding SubOwnerId Tag.");
         cborEncoderResult = cbor_encoder_create_array(&doxmMap, &subOwners, subOwnerLen);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SubOwner Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding SubOwner Array.");
 
         subOwner = NULL;
         LL_FOREACH(doxm->subOwners, subOwner)
@@ -311,10 +311,10 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
             VERIFY_SUCCESS(TAG, OC_STACK_OK == ret , ERROR);
             cborEncoderResult = cbor_encode_text_string(&subOwners, strSubOwnerUuid, strlen(strSubOwnerUuid));
             OICFree(strSubOwnerUuid);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SubOwnerId Value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding SubOwnerId Value");
         }
         cborEncoderResult = cbor_encoder_close_container(&doxmMap, &subOwners);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing SubOwnerId.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing SubOwnerId.");
     }
 
     //Multiple Owner Mode -- Not Mandatory
@@ -323,9 +323,9 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         OIC_LOG_V(DEBUG, TAG, "%s: including %s Property.", __func__, OIC_JSON_MOM_NAME);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_MOM_NAME,
             strlen(OIC_JSON_MOM_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding mom Tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding mom Tag");
         cborEncoderResult = cbor_encode_int(&doxmMap, (int64_t)doxm->mom->mode);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding mom Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding mom Value.");
     }
 #endif //MULTIPLE_OWNER
 
@@ -335,11 +335,11 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         OIC_LOG_V(DEBUG, TAG, "%s: including %s Property.", __func__, OIC_JSON_DEVOWNERID_NAME);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_DEVOWNERID_NAME,
             strlen(OIC_JSON_DEVOWNERID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding devowneruuid Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding devowneruuid Tag.");
         ret = ConvertUuidToStr(&doxm->owner, &strUuid);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret , ERROR);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, strUuid, strlen(strUuid));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding devowneruuid Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding devowneruuid Value.");
         OICFree(strUuid);
         strUuid = NULL;
     }
@@ -350,11 +350,11 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
         OIC_LOG_V(DEBUG, TAG, "%s: including %s Property.", __func__, OIC_JSON_ROWNERID_NAME);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_ROWNERID_NAME,
             strlen(OIC_JSON_ROWNERID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding rowneruuid Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding rowneruuid Tag.");
         ret = ConvertUuidToStr(&doxm->rownerID, &strUuid);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret , ERROR);
         cborEncoderResult = cbor_encode_text_string(&doxmMap, strUuid, strlen(strUuid));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding rowneruuid Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding rowneruuid Value.");
         OICFree(strUuid);
         strUuid = NULL;
     }
@@ -363,36 +363,36 @@ OCStackResult DoxmToCBORPayloadPartial(const OicSecDoxm_t *doxm,
     CborEncoder rtArray;
     cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_RT_NAME,
             strlen(OIC_JSON_RT_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&doxmMap, &rtArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&rtArray, OIC_RSRC_TYPE_SEC_DOXM,
                 strlen(OIC_RSRC_TYPE_SEC_DOXM));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
     }
     cborEncoderResult = cbor_encoder_close_container(&doxmMap, &rtArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RT.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RT.");
 
     //IF-- Mandatory
     CborEncoder ifArray;
     cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_IF_NAME,
        strlen(OIC_JSON_IF_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&doxmMap, &ifArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&ifArray, OC_RSRVD_INTERFACE_DEFAULT,
                 strlen(OC_RSRVD_INTERFACE_DEFAULT));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
     }
     cborEncoderResult = cbor_encoder_close_container(&doxmMap, &ifArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing IF.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing IF.");
 
     cborEncoderResult = cbor_encoder_close_container(&encoder, &doxmMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing DoxmMap.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing DoxmMap.");
 
     if (CborNoError == cborEncoderResult)
     {
@@ -477,14 +477,14 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
         OIC_LOG(DEBUG, TAG, "Found doxm.oxms tag in doxmMap.");
         CborValue oxm;
         cborFindResult = cbor_value_get_array_length(&doxmMap, &doxm->oxmLen);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding oxms array Length.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding oxms array Length.");
         VERIFY_SUCCESS(TAG, doxm->oxmLen != 0, ERROR);
 
         doxm->oxm = (OicSecOxm_t *)OICCalloc(doxm->oxmLen, sizeof(*doxm->oxm));
         VERIFY_NOT_NULL(TAG, doxm->oxm, ERROR);
 
         cborFindResult = cbor_value_enter_container(&doxmMap, &oxm);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering oxms Array.")
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering oxms Array.")
 
         int i = 0;
         while (cbor_value_is_valid(&oxm) && cbor_value_is_integer(&oxm))
@@ -492,11 +492,11 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
             int tmp;
 
             cborFindResult = cbor_value_get_int(&oxm, &tmp);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding oxms Value")
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding oxms Value")
             OIC_LOG_V(DEBUG, TAG, "Read doxm.oxms value = %d", tmp);
             doxm->oxm[i++] = (OicSecOxm_t)tmp;
             cborFindResult = cbor_value_advance(&oxm);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing oxms.")
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing oxms.")
         }
 
         if (roParsed)
@@ -528,7 +528,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
         int oxmSel;
 
         cborFindResult = cbor_value_get_int(&doxmMap, &oxmSel);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Sel Name Value.")
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Sel Name Value.")
         OIC_LOG_V(DEBUG, TAG, "Read doxm.oxmsel value = %d", oxmSel);
         doxm->oxmSel = (OicSecOxm_t)oxmSel;
         if (roParsed)
@@ -553,7 +553,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
         int sct;
 
         cborFindResult = cbor_value_get_int(&doxmMap, &sct);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Sct Name Value.")
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Sct Name Value.")
         OIC_LOG_V(DEBUG, TAG, "Read doxm.sct value = %d", sct);
         doxm->sct = (OicSecCredType_t)sct;
 
@@ -577,7 +577,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
     {
         OIC_LOG(DEBUG, TAG, "Found doxm.owned tag in doxmMap.");
         cborFindResult = cbor_value_get_boolean(&doxmMap, &doxm->owned);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Owned Value.")
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Owned Value.")
         OIC_LOG_V(DEBUG, TAG, "Read doxm.owned value = %s", doxm->owned?"true":"false");
 
         if (roParsed)
@@ -600,7 +600,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
     {
         OIC_LOG(DEBUG, TAG, "Found doxm.deviceuuid tag in doxmMap.");
         cborFindResult = cbor_value_dup_text_string(&doxmMap, &strUuid , &len, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Device Id Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Device Id Value.");
         OIC_LOG_V(DEBUG, TAG, "Read doxm.deviceuuid value = %s", strUuid);
         ret = ConvertStrToUuid(strUuid, &doxm->deviceID);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
@@ -627,7 +627,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
     {
         OIC_LOG(DEBUG, TAG, "Found doxm.devowneruuid tag in doxmMap.");
         cborFindResult = cbor_value_dup_text_string(&doxmMap, &strUuid , &len, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding devowneruuid Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding devowneruuid Value.");
         OIC_LOG_V(DEBUG, TAG, "Read doxm.devowneruuid value = %s", strUuid);
         ret = ConvertStrToUuid(strUuid , &doxm->owner);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
@@ -655,7 +655,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
         OIC_LOG(DEBUG, TAG, "Found doxm.mom tag in doxmMap.");
         int mode = 0;
         cborFindResult = cbor_value_get_int(&doxmMap, &mode);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding mom Name Value.")
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding mom Name Value.")
         if(NULL == doxm->mom)
         {
             doxm->mom = (OicSecMom_t*)OICCalloc(1, sizeof(OicSecMom_t));
@@ -688,11 +688,11 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
         size_t subOwnerLen = 0;
         CborValue subOwnerCbor;
         cborFindResult = cbor_value_get_array_length(&doxmMap, &subOwnerLen);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding SubOwner array Length.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding SubOwner array Length.");
         VERIFY_SUCCESS(TAG, 0 != subOwnerLen, ERROR);
 
         cborFindResult = cbor_value_enter_container(&doxmMap, &subOwnerCbor);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering SubOwner Array.")
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering SubOwner Array.")
 
         while (cbor_value_is_valid(&subOwnerCbor) && cbor_value_is_text_string(&subOwnerCbor))
         {
@@ -702,7 +702,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
             size_t uuidLen = 0;
 
             cborFindResult = cbor_value_dup_text_string(&subOwnerCbor, &strSubOwnerUuid, &uuidLen, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding SubOwnerId Value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding SubOwnerId Value");
 
             subOwner = (OicSecSubOwner_t*)OICCalloc(1, sizeof(OicSecSubOwner_t));
             VERIFY_NOT_NULL(TAG, subOwner, ERROR);
@@ -713,7 +713,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
             LL_APPEND(doxm->subOwners, subOwner);
 
             cborFindResult = cbor_value_advance(&subOwnerCbor);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing SubOwnerId.")
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Advancing SubOwnerId.")
         }
         if (roParsed)
         {
@@ -746,7 +746,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
     {
         OIC_LOG(DEBUG, TAG, "Found doxm.rowneruuid tag in doxmMap.");
         cborFindResult = cbor_value_dup_text_string(&doxmMap, &strUuid , &len, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding rowneruuid Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding rowneruuid Value.");
         OIC_LOG_V(DEBUG, TAG, "Read doxm.rowneruuid value = %s", strUuid);
         ret = ConvertStrToUuid(strUuid , &doxm->rownerID);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
index b7e6c6e..60da739 100644 (file)
@@ -291,37 +291,37 @@ OCStackResult UpdateResourceInPS(const char *databaseName, const char *resourceN
                 if ((CborNoError == cborFindResult) && cbor_value_is_byte_string(&curVal))
                 {
                     cborFindResult = cbor_value_dup_byte_string(&curVal, &aclCbor, &aclCborLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding ACL Name Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding ACL Name Value.");
                 }
                 cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_PSTAT_NAME, &curVal);
                 if ((CborNoError == cborFindResult) && cbor_value_is_byte_string(&curVal))
                 {
                     cborFindResult = cbor_value_dup_byte_string(&curVal, &pstatCbor, &pstatCborLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding PSTAT Name Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding PSTAT Name Value.");
                 }
                 cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_DOXM_NAME, &curVal);
                 if ((CborNoError == cborFindResult) && cbor_value_is_byte_string(&curVal))
                 {
                     cborFindResult = cbor_value_dup_byte_string(&curVal, &doxmCbor, &doxmCborLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding DOXM Name Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding DOXM Name Value.");
                 }
                 cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_AMACL_NAME, &curVal);
                 if ((CborNoError == cborFindResult) && cbor_value_is_byte_string(&curVal))
                 {
                     cborFindResult = cbor_value_dup_byte_string(&curVal, &amaclCbor, &amaclCborLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding AMACL Name Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding AMACL Name Value.");
                 }
                 cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_CRED_NAME, &curVal);
                 if ((CborNoError == cborFindResult) && cbor_value_is_byte_string(&curVal))
                 {
                     cborFindResult = cbor_value_dup_byte_string(&curVal, &credCbor, &credCborLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CRED Name Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding CRED Name Value.");
                 }
                 cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_RESET_PF_NAME, &curVal);
                 if ((CborNoError == cborFindResult) && cbor_value_is_byte_string(&curVal))
                 {
                     cborFindResult = cbor_value_dup_byte_string(&curVal, &resetPfCbor, &resetPfCborLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Reset Profile Name Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Reset Profile Name Value.");
                 }
                 int64_t cborFindCrlResult = cbor_value_map_find_value(&cbor, OIC_JSON_CRL_NAME, &curVal);
                 if ((CborNoError == cborFindCrlResult) && cbor_value_is_byte_string(&curVal))
@@ -344,7 +344,7 @@ OCStackResult UpdateResourceInPS(const char *databaseName, const char *resourceN
                 if ((CborNoError == cborFindResult) && cbor_value_is_byte_string(&curVal))
                 {
                     cborFindResult = cbor_value_dup_byte_string(&curVal, &dpCbor, &dpCborLen, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Device Properties Name Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Device Properties Name Value.");
                 }
             }
         }
@@ -370,15 +370,15 @@ OCStackResult UpdateResourceInPS(const char *databaseName, const char *resourceN
             cbor_encoder_init(&encoder, outPayload, allocSize, 0);
             CborEncoder resource;  // will be initialized in |cbor_encoder_create_map|
             cborEncoderResult |= cbor_encoder_create_map(&encoder, &resource, CborIndefiniteLength);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PS Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PS Map.");
 
             // Encode the updated payload and add it to our map so it will be stored in the database.
             if (payload && size)
             {
                 cborEncoderResult |= cbor_encode_text_string(&resource, resourceName, strlen(resourceName));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Value Tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Value Tag");
                 cborEncoderResult |= cbor_encode_byte_string(&resource, payload, size);
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Value.");
             }
 
             // Check all of the resources from a particular database to see if we need to encode them. If the resource
@@ -391,51 +391,51 @@ OCStackResult UpdateResourceInPS(const char *databaseName, const char *resourceN
                 if (strcmp(OIC_JSON_ACL_NAME, resourceName) && aclCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OIC_JSON_ACL_NAME, strlen(OIC_JSON_ACL_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, aclCbor, aclCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Value.");
                 }
                 if (strcmp(OIC_JSON_PSTAT_NAME, resourceName) && pstatCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OIC_JSON_PSTAT_NAME, strlen(OIC_JSON_PSTAT_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, pstatCbor, pstatCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
                 }
                 if (strcmp(OIC_JSON_DOXM_NAME, resourceName) && doxmCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OIC_JSON_DOXM_NAME, strlen(OIC_JSON_DOXM_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Doxm Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Doxm Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, doxmCbor, doxmCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Doxm Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Doxm Value.");
                 }
                 if (strcmp(OIC_JSON_AMACL_NAME, resourceName) && amaclCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OIC_JSON_AMACL_NAME, strlen(OIC_JSON_AMACL_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Amacl Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Amacl Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, amaclCbor, amaclCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Amacl Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Amacl Value.");
                 }
                 if (strcmp(OIC_JSON_CRED_NAME, resourceName) && credCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OIC_JSON_CRED_NAME, strlen(OIC_JSON_CRED_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, credCbor, credCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Cred Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Cred Value.");
                 }
                 if (strcmp(OIC_JSON_RESET_PF_NAME, resourceName) && resetPfCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OIC_JSON_RESET_PF_NAME, strlen(OIC_JSON_RESET_PF_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Reset Profile Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Reset Profile Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, resetPfCbor, resetPfCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Reset Profile Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Reset Profile Value.");
                 }
                 if (strcmp(OIC_JSON_CRL_NAME, resourceName) && crlCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OIC_JSON_CRL_NAME, strlen(OIC_JSON_CRL_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Crl Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Crl Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, crlCbor, crlCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Crl Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Crl Value.");
                 }
             }
             else
@@ -444,14 +444,14 @@ OCStackResult UpdateResourceInPS(const char *databaseName, const char *resourceN
                 if (strcmp(OC_JSON_DEVICE_PROPS_NAME, resourceName) && dpCborLen)
                 {
                     cborEncoderResult |= cbor_encode_text_string(&resource, OC_JSON_DEVICE_PROPS_NAME, strlen(OC_JSON_DEVICE_PROPS_NAME));
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Device Properties Name.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Device Properties Name.");
                     cborEncoderResult |= cbor_encode_byte_string(&resource, dpCbor, dpCborLen);
-                    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Device Properties Value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Device Properties Value.");
                 }
             }
 
             cborEncoderResult |= cbor_encoder_close_container(&encoder, &resource);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Array.");
             outSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
         }
     }
@@ -465,15 +465,15 @@ OCStackResult UpdateResourceInPS(const char *databaseName, const char *resourceN
         cbor_encoder_init(&encoder, outPayload, allocSize, 0);
         CborEncoder resource;  // will be initialized in |cbor_encoder_create_map|
         cborEncoderResult |= cbor_encoder_create_map(&encoder, &resource, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PS Map.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PS Map.");
 
         cborEncoderResult |= cbor_encode_text_string(&resource, resourceName, strlen(resourceName));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Value Tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Value Tag");
         cborEncoderResult |= cbor_encode_byte_string(&resource, payload, size);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Value.");
 
         cborEncoderResult |= cbor_encoder_close_container(&encoder, &resource);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Array.");
         outSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
     }
 
@@ -571,7 +571,7 @@ OCStackResult ResetSecureResourceInPS(void)
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &resetPfCbor, &resetPfCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Reset Profile Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding Reset Profile Name Value.");
             }
         }
 
@@ -586,25 +586,25 @@ OCStackResult ResetSecureResourceInPS(void)
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &aclCbor, &aclCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding ACL Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding ACL Name Value.");
             }
             cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_CRED_NAME, &curVal);
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &credCbor, &credCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding ACL Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding ACL Name Value.");
             }
             cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_PSTAT_NAME, &curVal);
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &pstatCbor, &pstatCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding PSTAT Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding PSTAT Name Value.");
             }
             cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_DOXM_NAME, &curVal);
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &doxmCbor, &doxmCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding DOXM Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding DOXM Name Value.");
             }
         }
 
@@ -619,35 +619,35 @@ OCStackResult ResetSecureResourceInPS(void)
             cborEncoderResult |= cbor_encoder_create_map(&encoder, &secRsrc, CborIndefiniteLength);
 
             cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_ACL_NAME, strlen(OIC_JSON_ACL_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Name.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Name.");
             cborEncoderResult |= cbor_encode_byte_string(&secRsrc, aclCbor, aclCborLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Value.");
 
             if (credCborLen)
             {
                 cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_CRED_NAME, strlen(OIC_JSON_CRED_NAME));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CRED Name.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CRED Name.");
                 cborEncoderResult |= cbor_encode_byte_string(&secRsrc, credCbor, credCborLen);
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CRED Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CRED Value.");
             }
 
             cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_PSTAT_NAME, strlen(OIC_JSON_PSTAT_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
             cborEncoderResult |= cbor_encode_byte_string(&secRsrc, pstatCbor, pstatCborLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
 
             cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_DOXM_NAME, strlen(OIC_JSON_DOXM_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding DOXM Name.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding DOXM Name.");
             cborEncoderResult |= cbor_encode_byte_string(&secRsrc, doxmCbor, doxmCborLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding DOXM Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding DOXM Value.");
 
             cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_RESET_PF_NAME, strlen(OIC_JSON_RESET_PF_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Reset Profile Name.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Reset Profile Name.");
             cborEncoderResult |= cbor_encode_byte_string(&secRsrc, resetPfCbor, resetPfCborLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Reset Profile Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Reset Profile Value.");
 
             cborEncoderResult |= cbor_encoder_close_container(&encoder, &secRsrc);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Array.");
             outSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
         }
 
@@ -721,25 +721,25 @@ OCStackResult CreateResetProfile(void)
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &aclCbor, &aclCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding ACL Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding ACL Name Value.");
             }
             cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_CRED_NAME, &curVal);
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &credCbor, &credCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CRED Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding CRED Name Value.");
             }
             cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_PSTAT_NAME, &curVal);
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &pstatCbor, &pstatCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding PSTAT Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding PSTAT Name Value.");
             }
             cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_DOXM_NAME, &curVal);
             if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
             {
                 cborFindResult = cbor_value_dup_byte_string(&curVal, &doxmCbor, &doxmCborLen, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult,  "Failed Finding DOXM Name Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult,  "Failed Finding DOXM Name Value.");
             }
         }
 
@@ -753,30 +753,30 @@ OCStackResult CreateResetProfile(void)
             cborEncoderResult |= cbor_encoder_create_map(&encoder, &secRsrc, CborIndefiniteLength);
 
             cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_ACL_NAME, strlen(OIC_JSON_ACL_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Name.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Name.");
             cborEncoderResult |= cbor_encode_byte_string(&secRsrc, aclCbor, aclCborLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Value.");
 
             if (credCborLen)
             {
                 cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_CRED_NAME, strlen(OIC_JSON_CRED_NAME));
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CRED Name.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CRED Name.");
                 cborEncoderResult |= cbor_encode_byte_string(&secRsrc, credCbor, credCborLen);
-                VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CRED Value.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CRED Value.");
             }
 
             cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_PSTAT_NAME, strlen(OIC_JSON_PSTAT_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
             cborEncoderResult |= cbor_encode_byte_string(&secRsrc, pstatCbor, pstatCborLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
 
             cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_DOXM_NAME, strlen(OIC_JSON_DOXM_NAME));
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Doxm Name.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Doxm Name.");
             cborEncoderResult |= cbor_encode_byte_string(&secRsrc, doxmCbor, doxmCborLen);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Doxm Value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Doxm Value.");
 
             cborEncoderResult |= cbor_encoder_close_container(&encoder, &secRsrc);
-            VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Array.");
             resetPfCborLen = cbor_encoder_get_buffer_size(&encoder, resetPfCbor);
         }
 
index 5cd1bd7..1d8bb67 100644 (file)
@@ -213,7 +213,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
 
     // Top Level Pstat Map
     cborEncoderResult = cbor_encoder_create_map(&encoder, &pstatMap, pstatMapSize);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Pstat Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Pstat Map.");
 
     // dos Property
     if (propertiesToInclude[PSTAT_DOS])
@@ -222,29 +222,29 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
         // Device Onboarding State Property tag
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_DOS_NAME,
             strlen(OIC_JSON_DOS_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding dos Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding dos Name Tag.");
 
         // Device Onboarding State Property map
         CborEncoder dosMap;
         cborEncoderResult = cbor_encoder_create_map(&pstatMap, &dosMap, PSTAT_DOS_MAP_SIZE);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating pstat.dos map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed creating pstat.dos map");
 
         cborEncoderResult = cbor_encode_text_string(&dosMap, OIC_JSON_S_NAME,
             strlen(OIC_JSON_S_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.s tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding pstat.dos.s tag.");
 
         cborEncoderResult = cbor_encode_int(&dosMap, pstat->dos.state);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.s value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding pstat.dos.s value.");
 
         cborEncoderResult = cbor_encode_text_string(&dosMap, OIC_JSON_P_NAME,
             strlen(OIC_JSON_P_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.p tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding pstat.dos.p tag.");
 
         cborEncoderResult = cbor_encode_boolean(&dosMap, pstat->dos.pending);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.p value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding pstat.dos.p value.");
 
         cborEncoderResult = cbor_encoder_close_container(&pstatMap, &dosMap);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing pstat.dos map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing pstat.dos map");
     }
 
     // isop Property
@@ -253,9 +253,9 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
         OIC_LOG_V(DEBUG, TAG, "%s: including isop Property.", __func__);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_ISOP_NAME,
             strlen(OIC_JSON_ISOP_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ISOP Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ISOP Name Tag.");
         cborEncoderResult = cbor_encode_boolean(&pstatMap, pstat->isOp);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ISOP Name Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ISOP Name Value.");
     }
 
     // cm Property
@@ -264,9 +264,9 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
         OIC_LOG_V(DEBUG, TAG, "%s: including cm Property.", __func__);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_CM_NAME,
             strlen(OIC_JSON_CM_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CM Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CM Name Tag.");
         cborEncoderResult = cbor_encode_int(&pstatMap, pstat->cm);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CM Name Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CM Name Value.");
     }
 
     // tm Property
@@ -275,9 +275,9 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
         OIC_LOG_V(DEBUG, TAG, "%s: including tm Property.", __func__);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_TM_NAME,
             strlen(OIC_JSON_TM_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding TM Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding TM Name Tag.");
         cborEncoderResult = cbor_encode_int(&pstatMap, pstat->tm);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding TM Name Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding TM Name Value.");
     }
 
     // om Property
@@ -286,9 +286,9 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
         OIC_LOG_V(DEBUG, TAG, "%s: including om Property.", __func__);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_OM_NAME,
             strlen(OIC_JSON_OM_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding OM Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding OM Name Tag.");
         cborEncoderResult = cbor_encode_int(&pstatMap, pstat->om);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding OM Name Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding OM Name Value.");
     }
 
     // sm Property
@@ -297,9 +297,9 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
         OIC_LOG_V(DEBUG, TAG, "%s: including sm Property.", __func__);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_SM_NAME,
             strlen(OIC_JSON_SM_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SM Name Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding SM Name Tag.");
         cborEncoderResult = cbor_encode_int(&pstatMap, pstat->sm[0]);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SM Name Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding SM Name Value.");
     }
 
     // rowneruuid property
@@ -308,11 +308,11 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
         OIC_LOG_V(DEBUG, TAG, "%s: including rowneruuid Property.", __func__);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_ROWNERID_NAME,
             strlen(OIC_JSON_ROWNERID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ROwner Id Tag.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ROwner Id Tag.");
         ret = ConvertUuidToStr(&pstat->rownerID, &strUuid);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret , ERROR);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, strUuid, strlen(strUuid));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ROwner Id Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ROwner Id Value.");
         OICFree(strUuid);
         strUuid = NULL;
     }
@@ -321,36 +321,36 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
     CborEncoder rtArray;
     cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_RT_NAME,
             strlen(OIC_JSON_RT_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&pstatMap, &rtArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&rtArray, OIC_RSRC_TYPE_SEC_PSTAT,
                 strlen(OIC_RSRC_TYPE_SEC_PSTAT));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
     }
     cborEncoderResult = cbor_encoder_close_container(&pstatMap, &rtArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RT.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RT.");
 
     //IF-- Mandatory
     CborEncoder ifArray;
     cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_IF_NAME,
        strlen(OIC_JSON_IF_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
     cborEncoderResult = cbor_encoder_create_array(&pstatMap, &ifArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&ifArray, OC_RSRVD_INTERFACE_DEFAULT,
                 strlen(OC_RSRVD_INTERFACE_DEFAULT));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
     }
     cborEncoderResult = cbor_encoder_close_container(&pstatMap, &ifArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing IF.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing IF.");
 
     cborEncoderResult = cbor_encoder_close_container(&encoder, &pstatMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Closing PSTAT Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Closing PSTAT Map.");
 
     if (CborNoError == cborEncoderResult)
     {
@@ -448,11 +448,11 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
 
     // Enter pstat Map
     cborFindResult = cbor_value_enter_container(&pstatCbor, &pstatMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering pstat Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering pstat Map.");
 
     // Find pstat.dos tag
     cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_DOS_NAME, &pstatMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding dos tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding dos tag.");
 
     if (CborInvalidType != pstatMap.type)
     {
@@ -462,7 +462,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
         {
             OIC_LOG(DEBUG, TAG, "Found pstat.dos cbor container; entering.");
             cborFindResult = cbor_value_enter_container(&pstatMap, &dosMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering dos map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering dos map.");
             if (roParsed)
             {
                 if (IsPropertyReadOnly(PSTAT_DOS, stateForReadOnlyCheck))
@@ -474,9 +474,9 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
         while (cbor_value_is_valid(&dosMap) && cbor_value_is_text_string(&dosMap))
         {
             cborFindResult = cbor_value_dup_text_string(&dosMap, &dosTagName, &dosLen, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting dos map next tag.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting dos map next tag.");
             cborFindResult = cbor_value_advance(&dosMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing dos map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing dos map.");
 
             if (NULL != dosTagName)
             {
@@ -485,7 +485,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
                     OIC_LOG(DEBUG, TAG, "Found pstat.dos.s tag; getting int value.");
                     int s = -1;
                     cborFindResult = cbor_value_get_int(&dosMap, &s);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting pstat.dos.s value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting pstat.dos.s value.");
                     OIC_LOG_V(DEBUG, TAG, "Read pstat.dos.s value = %d.", s);
                     pstat->dos.state = (OicSecDeviceOnboardingState_t)s;
                 }
@@ -494,7 +494,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
                     OIC_LOG(DEBUG, TAG, "Found pstat.dos.p tag; getting boolean value.");
                     bool p = false;
                     cborFindResult = cbor_value_get_boolean(&dosMap, &p);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting pstat.dos.p value.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed getting pstat.dos.p value.");
                     OIC_LOG_V(DEBUG, TAG, "Read pstat.dos.p value = %s.", p?"true":"false");
                     pstat->dos.pending = p;
                 }
@@ -509,7 +509,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
             if (cbor_value_is_valid(&dosMap))
             {
                 cborFindResult = cbor_value_advance(&dosMap);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing dos map.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing dos map.");
             }
         }
     }
@@ -530,7 +530,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
     if (CborNoError == cborFindResult && cbor_value_is_boolean(&pstatMap))
     {
         cborFindResult = cbor_value_get_boolean(&pstatMap, &pstat->isOp);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding isOp Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding isOp Value.");
 
         if (roParsed)
         {
@@ -553,7 +553,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
         int cm;
 
         cborFindResult = cbor_value_get_int(&pstatMap, &cm);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CM.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding CM.");
         pstat->cm = (OicSecDpm_t)cm;
 
         if (roParsed)
@@ -577,7 +577,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
         int tm;
 
         cborFindResult = cbor_value_get_int(&pstatMap, &tm);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding TM.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding TM.");
         pstat->tm = (OicSecDpm_t)tm;
 
         if (roParsed)
@@ -602,7 +602,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
         int om;
 
         cborFindResult = cbor_value_get_int(&pstatMap, &om);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding OM.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding OM.");
         pstat->om = (OicSecDpom_t)om;
 
         if (roParsed)
@@ -629,7 +629,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
         pstat->sm = (OicSecDpom_t*)OICCalloc(pstat->smLen, sizeof(OicSecDpom_t));
         VERIFY_NOT_NULL(TAG, pstat->sm, ERROR);
         cborFindResult = cbor_value_get_int(&pstatMap, &sm);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding SM.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding SM.");
         pstat->sm[0] = (OicSecDpom_t)sm;
 
         if (roParsed)
@@ -655,7 +655,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
     if (CborNoError == cborFindResult && cbor_value_is_text_string(&pstatMap))
     {
         cborFindResult = cbor_value_dup_text_string(&pstatMap, &strUuid , &len, NULL);
-        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding ROwner Id Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding ROwner Id Value.");
         ret = ConvertStrToUuid(strUuid , &pstat->rownerID);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
         OICFree(strUuid );
index bdad20a..0bebc9e 100644 (file)
@@ -459,11 +459,11 @@ OCStackResult RolesToCBORPayload(const RoleCertChain_t *roles, uint8_t **cborPay
 
     // Create roles root map (roles, rt, if)
     cborEncoderResult = cbor_encoder_create_map(&encoder, &rolesRootMap, 3);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding roles root map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding roles root map");
 
     // Roles array
     cborEncoderResult = cbor_encode_text_string(&rolesRootMap, OIC_JSON_ROLES_NAME, strlen(OIC_JSON_ROLES_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding roles name tag");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding roles name tag");
     VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for roles name tag")
 
     // If roles is NULL, the "roles" array will be empty
@@ -473,7 +473,7 @@ OCStackResult RolesToCBORPayload(const RoleCertChain_t *roles, uint8_t **cborPay
     }
 
     cborEncoderResult = cbor_encoder_create_array(&rolesRootMap, &rolesArray, roleCount);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding roles array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding roles array");
 
     for (currChain = roles; NULL != currChain; currChain = currChain->next)
     {
@@ -481,84 +481,84 @@ OCStackResult RolesToCBORPayload(const RoleCertChain_t *roles, uint8_t **cborPay
         size_t mapSize = ROLE_MAP_SIZE;
 
         cborEncoderResult = cbor_encoder_create_map(&rolesArray, &roleMap, mapSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding role map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding role map");
 
         // credId - mandatory
         cborEncoderResult = cbor_encode_text_string(&roleMap, OIC_JSON_CREDID_NAME, strlen(OIC_JSON_CREDID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding credId tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding credId tag");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for credId tag")
         cborEncoderResult = cbor_encode_int(&roleMap, currChain->credId);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding credId value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding credId value");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for credId value")
 
         // subjectuuid - mandatory - always zero for role certificates
         cborEncoderResult = cbor_encode_text_string(&roleMap, OIC_JSON_SUBJECTID_NAME, strlen(OIC_JSON_SUBJECTID_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding subject tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding subject tag");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for subject tag")
         cborEncoderResult = cbor_encode_text_string(&roleMap, EMPTY_UUID, sizeof(EMPTY_UUID) - 1);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding subject value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding subject value");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for subject value")
 
         // publicData - mandatory
         cborEncoderResult = SerializeEncodingToCbor(&roleMap, OIC_JSON_PUBLICDATA_NAME, &currChain->certificate);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding publicData");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding publicData");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for publicData")
 
         // credType - mandatory
         cborEncoderResult = cbor_encode_text_string(&roleMap, OIC_JSON_CREDTYPE_NAME, strlen(OIC_JSON_CREDTYPE_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding credType tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding credType tag");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for  credType tag")
         // Per security spec, only SIGNED_ASYMMETRIC_KEY is supported here.
         cborEncoderResult = cbor_encode_int(&roleMap, SIGNED_ASYMMETRIC_KEY);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding credType value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed adding credType value");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for credType value")
 
         cborEncoderResult = cbor_encoder_close_container(&rolesArray, &roleMap);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing role map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing role map");
     }
 
     cborEncoderResult = cbor_encoder_close_container(&rolesRootMap, &rolesArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing roles array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing roles array");
 
     // RT -- Mandatory
     CborEncoder rtArray;
     cborEncoderResult = cbor_encode_text_string(&rolesRootMap, OIC_JSON_RT_NAME,
         strlen(OIC_JSON_RT_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Name Tag.");
     VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for RT Name Tag")
     cborEncoderResult = cbor_encoder_create_array(&rolesRootMap, &rtArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RT Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding RT Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&rtArray, OIC_RSRC_TYPE_SEC_ROLES,
             strlen(OIC_RSRC_TYPE_SEC_ROLES));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding RT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding RT Value.");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for RT Value")
     }
     cborEncoderResult = cbor_encoder_close_container(&rolesRootMap, &rtArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing RT.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing RT.");
 
     // IF-- Mandatory
     CborEncoder ifArray;
     cborEncoderResult = cbor_encode_text_string(&rolesRootMap, OIC_JSON_IF_NAME,
         strlen(OIC_JSON_IF_NAME));
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Name Tag.");
     VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for IF Name Tag")
     cborEncoderResult = cbor_encoder_create_array(&rolesRootMap, &ifArray, 1);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding IF Value.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Addding IF Value.");
     for (size_t i = 0; i < 1; i++)
     {
         cborEncoderResult = cbor_encode_text_string(&ifArray, OC_RSRVD_INTERFACE_DEFAULT,
             strlen(OC_RSRVD_INTERFACE_DEFAULT));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding IF Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding IF Value.");
         VERIFY_CBOR_NOT_OUTOFMEMORY(TAG, cborEncoderResult, "Not enough memory for IF Value")
     }
     cborEncoderResult = cbor_encoder_close_container(&rolesRootMap, &ifArray);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing IF.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing IF.");
 
     // Close roles root map
     cborEncoderResult = cbor_encoder_close_container(&encoder, &rolesRootMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing roles root map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed closing roles root map");
 
     *cborSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
     *cborPayload = outPayload;
@@ -604,7 +604,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
     size_t len = 0;
 
     cborFindResult = cbor_parser_init(cborPayload, size, 0, &parser, &rolesCbor);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to initialize parser.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to initialize parser.");
 
     if (!cbor_value_is_container(&rolesCbor))
     {
@@ -615,7 +615,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
     CborValue rolesRootMap;
     memset(&rolesRootMap, 0, sizeof(rolesRootMap));
     cborFindResult = cbor_value_enter_container(&rolesCbor, &rolesRootMap);
-    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering roles Root Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering roles Root Map.");
 
     while (cbor_value_is_valid(&rolesRootMap))
     {
@@ -629,9 +629,9 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
         if (type == CborTextStringType && cbor_value_is_text_string(&rolesRootMap))
         {
             cborFindResult = cbor_value_dup_text_string(&rolesRootMap, &tagName, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed finding name in roles Root Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed finding name in roles Root Map.");
             cborFindResult = cbor_value_advance(&rolesRootMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing value in roles Root Map.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing value in roles Root Map.");
         }
         else
         {
@@ -649,7 +649,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
                 memset(&roleArray, 0, sizeof(roleArray));
 
                 cborFindResult = cbor_value_enter_container(&rolesRootMap, &roleArray);
-                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed entering role array.");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed entering role array.");
 
                 while (cbor_value_is_valid(&roleArray))
                 {
@@ -657,7 +657,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
                     CborValue roleMap;
                     memset(&roleMap, 0, sizeof(roleMap));
                     cborFindResult = cbor_value_enter_container(&roleArray, &roleMap);
-                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed entering role map.");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed entering role map.");
 
                     if (NULL == currEntry)
                     {
@@ -681,9 +681,9 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
                         if (innerType == CborTextStringType)
                         {
                             cborFindResult = cbor_value_dup_text_string(&roleMap, &tagName, &len, NULL);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed finding name in role map.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed finding name in role map.");
                             cborFindResult = cbor_value_advance(&roleMap);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing value in role map.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing value in role map.");
                         }
                         if (NULL != tagName)
                         {
@@ -692,18 +692,18 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
                             {
                                 uint64_t credId64 = 0;
                                 cborFindResult = cbor_value_get_uint64(&roleMap, &credId64);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed retrieving credId.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed retrieving credId.");
                                 if (UINT32_MAX < credId64)
                                 {
                                     cborFindResult = CborUnknownError;
-                                    VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "credId was too large.");
+                                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "credId was too large.");
                                 }
                                 currEntry->credId = (uint32_t)credId64;
                             }
                             else if (strcmp(tagName, OIC_JSON_PUBLICDATA_NAME) == 0)
                             {
                                 cborFindResult = DeserializeEncodingFromCbor(&roleMap, &currEntry->certificate);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to read publicData");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed to read publicData");
 
                                 /* mbedtls_x509_crt_parse requires null string terminator */
                                 VERIFY_TRUE_OR_EXIT(TAG, AddNullTerminator(&currEntry->certificate), ERROR);
@@ -712,7 +712,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
                             {
                                 uint64_t credType = 0;
                                 cborFindResult = cbor_value_get_uint64(&roleMap, &credType);
-                                VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed retrieving credType.");
+                                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed retrieving credType.");
                                 /* Only SIGNED_ASYMMETRIC_KEY is supported. */
                                 if (SIGNED_ASYMMETRIC_KEY != (OicSecCredType_t)credType)
                                 {
@@ -730,7 +730,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
                         if (cbor_value_is_valid(&roleMap))
                         {
                             cborFindResult = cbor_value_advance(&roleMap);
-                            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing role map.");
+                            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing role map.");
                         }
                     }
 
@@ -743,7 +743,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
                     if (cbor_value_is_valid(&roleArray))
                     {
                         cborFindResult = cbor_value_advance(&roleArray);
-                        VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing role array.");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing role array.");
                     }
                 }
             }
@@ -757,7 +757,7 @@ OCStackResult CBORPayloadToRoles(const uint8_t *cborPayload, size_t size, RoleCe
         if (cbor_value_is_valid(&rolesRootMap))
         {
             cborFindResult = cbor_value_advance(&rolesRootMap);
-            VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing CSR Root Map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed advancing CSR Root Map");
         }
     }
 
index 90799cf..a0c24f4 100644 (file)
@@ -472,54 +472,54 @@ static OCStackResult ConvertOCJSONStringToCBORFile(const char *jsonStr, const ch
     cbor_encoder_init(&encoder, outPayload, cborSize, 0);
     CborEncoder map;
     CborError cborEncoderResult = cbor_encoder_create_map(&encoder, &map, CborIndefiniteLength);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating Main Map.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Creating Main Map.");
     if ((aclCborSize > 0) && aclCbor)
     {
         cborEncoderResult = cbor_encode_text_string(&map, OIC_JSON_ACL_NAME, strlen(OIC_JSON_ACL_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Name.");
         cborEncoderResult = cbor_encode_byte_string(&map, aclCbor, aclCborSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ACL Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ACL Value.");
     }
 
     if ((pstatCborSize > 0) && pstatCbor)
     {
         cborEncoderResult = cbor_encode_text_string(&map, OIC_JSON_PSTAT_NAME, strlen(OIC_JSON_PSTAT_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Name.");
         cborEncoderResult = cbor_encode_byte_string(&map, pstatCbor, pstatCborSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding PSTAT Value.");
     }
     if ((doxmCborSize > 0) && doxmCbor)
     {
         cborEncoderResult = cbor_encode_text_string(&map, OIC_JSON_DOXM_NAME, strlen(OIC_JSON_DOXM_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding DOXM Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding DOXM Name.");
         cborEncoderResult = cbor_encode_byte_string(&map, doxmCbor, doxmCborSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding DOXM Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding DOXM Value.");
     }
     if ((amaclCborSize > 0) && amaclCbor)
     {
         cborEncoderResult = cbor_encode_text_string(&map, OIC_JSON_AMACL_NAME, strlen(OIC_JSON_AMACL_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding AMACL Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding AMACL Name.");
         cborEncoderResult = cbor_encode_byte_string(&map, amaclCbor, amaclCborSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding AMACL Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding AMACL Value.");
     }
     if ((credCborSize > 0) && credCbor)
     {
         cborEncoderResult = cbor_encode_text_string(&map, OIC_JSON_CRED_NAME, strlen(OIC_JSON_CRED_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CRED Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CRED Name.");
         cborEncoderResult = cbor_encode_byte_string(&map, credCbor, credCborSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CRED Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CRED Value.");
     }
     if ((dpCborSize > 0) && dpCbor)
     {
         cborEncoderResult = cbor_encode_text_string(&map, OC_JSON_DEVICE_PROPS_NAME,
                             strlen(OC_JSON_DEVICE_PROPS_NAME));
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Device Properties Name.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Device Properties Name.");
         cborEncoderResult = cbor_encode_byte_string(&map, dpCbor, dpCborSize);
-        VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Device Properties Value.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding Device Properties Value.");
     }
 
     cborEncoderResult = cbor_encoder_close_container(&encoder, &map);
-    VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Container.");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Closing Container.");
 
     size_t s = cbor_encoder_get_buffer_size(&encoder, outPayload);
     OIC_LOG_V(DEBUG, TAG, "Payload size %" PRIuPTR, s);
index 40e5315..bb9f182 100644 (file)
@@ -45,7 +45,7 @@ extern "C"
 /**
  * Macro to verify the validity of cbor operation.
  */
-#define VERIFY_CBOR_SUCCESS(log_tag, err, log_message) \
+#define VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(log_tag, err, log_message) \
     if ((CborNoError != (err)) && (CborErrorOutOfMemory != (err))) \
     { \
         if ((log_tag) && (log_message)) \
index d0e8587..fe50295 100644 (file)
@@ -248,7 +248,7 @@ static int64_t OCConvertResourcePayloadCbor(CborEncoder *linkArray, OCResourcePa
     }
     CborEncoder linkMap;
     err |= cbor_encoder_create_map(linkArray, &linkMap, linkMapLen);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating links map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating links map");
 
     // Below are insertions of the resource properties into the map.
 
@@ -260,13 +260,13 @@ static int64_t OCConvertResourcePayloadCbor(CborEncoder *linkArray, OCResourcePa
         {
             err = CborErrorInternalError;
         }
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating endpoint string");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating endpoint string");
         char uri[MAX_URI_LENGTH];
         int snRet = snprintf(uri, MAX_URI_LENGTH, "%s%s", endpointStr, resource->uri);
         if(0 > snRet || snRet >= MAX_URI_LENGTH)
         {
             OICFree(endpointStr);
-            VERIFY_CBOR_SUCCESS(TAG, CborErrorInternalError, "Error (snprintf)");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, CborErrorInternalError, "Error (snprintf)");
         }
 
         OICFree(endpointStr);
@@ -279,54 +279,54 @@ static int64_t OCConvertResourcePayloadCbor(CborEncoder *linkArray, OCResourcePa
         err |= AddTextStringToMap(&linkMap, OC_RSRVD_HREF, sizeof(OC_RSRVD_HREF) - 1,
                                   resource->uri);
     }
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding uri to links map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding uri to links map");
 
     // Rel - Not a mandatory field
     err |= ConditionalAddTextStringToMap(&linkMap, OC_RSRVD_REL, sizeof(OC_RSRVD_REL) - 1,
                                          resource->rel);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rel to links map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rel to links map");
 
     // Resource Type
     err |= OCStringLLJoin(&linkMap, OC_RSRVD_RESOURCE_TYPE, resource->types);
-    VERIFY_CBOR_SUCCESS(TAG, err,
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err,
                         "Failed adding resourceType tag/value to links map");
 
     // Interface Types
     err |= OCStringLLJoin(&linkMap, OC_RSRVD_INTERFACE, resource->interfaces);
-    VERIFY_CBOR_SUCCESS(TAG, err,
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err,
                         "Failed adding interfaces tag/value to links map");
 
     // Policy
     CborEncoder policyMap;
     err |= cbor_encode_text_string(&linkMap, OC_RSRVD_POLICY,
                                    sizeof(OC_RSRVD_POLICY) - 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding policy tag to links map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding policy tag to links map");
     err |= cbor_encoder_create_map(&linkMap, &policyMap, CborIndefiniteLength);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding policy map to links map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding policy map to links map");
 
     // Bitmap
     err |=  cbor_encode_text_string(&policyMap, OC_RSRVD_BITMAP,
                                     sizeof(OC_RSRVD_BITMAP) - 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding bitmap tag to policy map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding bitmap tag to policy map");
     err |= cbor_encode_uint(&policyMap, resource->bitmap);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding bitmap value to policy map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding bitmap value to policy map");
 
     // Secure
     bool isSecure;
     isSecure = endpoint ? (endpoint->family & OC_FLAG_SECURE) : resource->secure;
     err |= cbor_encode_text_string(&policyMap, OC_RSRVD_SECURE,
                                    sizeof(OC_RSRVD_SECURE) - 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding secure tag to policy map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding secure tag to policy map");
     err |= cbor_encode_boolean(&policyMap, isSecure);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding secure value to policy map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding secure value to policy map");
 
     if (isSecure)
     {
         err |= cbor_encode_text_string(&policyMap, OC_RSRVD_HOSTING_PORT,
                                        sizeof(OC_RSRVD_HOSTING_PORT) - 1);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding secure port tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding secure port tag");
         err |= cbor_encode_uint(&policyMap, endpoint ? endpoint->port : resource->port);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding secure port value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding secure port value");
     }
 
 #ifdef TCP_ADAPTER
@@ -336,9 +336,9 @@ static int64_t OCConvertResourcePayloadCbor(CborEncoder *linkArray, OCResourcePa
     {
         err |= cbor_encode_text_string(&policyMap, OC_RSRVD_TLS_PORT,
                                        sizeof(OC_RSRVD_TLS_PORT) - 1);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding tcp secure port tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding tcp secure port tag");
         err |= cbor_encode_uint(&policyMap, endpoint ? endpoint->port : resource->tcpPort);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding tcp secure port value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding tcp secure port value");
     }
 
     // tcp
@@ -347,17 +347,17 @@ static int64_t OCConvertResourcePayloadCbor(CborEncoder *linkArray, OCResourcePa
     {
         err |= cbor_encode_text_string(&policyMap, OC_RSRVD_TCP_PORT,
                                        sizeof(OC_RSRVD_TCP_PORT) - 1);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding tcp port tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding tcp port tag");
         err |= cbor_encode_uint(&policyMap, endpoint ? endpoint->port : resource->tcpPort);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding tcp port value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding tcp port value");
     }
 #endif
     err |= cbor_encoder_close_container(&linkMap, &policyMap);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing policy map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing policy map");
 
     // Finished encoding a resource, close the map.
     err |= cbor_encoder_close_container(linkArray, &linkMap);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing link map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing link map");
 
 exit:
     return err;
@@ -407,40 +407,40 @@ static int64_t OCConvertDiscoveryPayloadCbor(OCDiscoveryPayload *payload,
     }
     CborEncoder rootArray;
     err |= cbor_encoder_create_array(&encoder, &rootArray, arrayCount);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating discovery root array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating discovery root array");
 
     while (payload && payload->resources)
     {
         // Open the root map in the root array
         CborEncoder rootMap;
         err |= cbor_encoder_create_map(&rootArray, &rootMap, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating discovery map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating discovery map");
 
         // Insert Name
         err |= ConditionalAddTextStringToMap(&rootMap, OC_RSRVD_DEVICE_NAME,
                 sizeof(OC_RSRVD_DEVICE_NAME) - 1, payload->name);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting name");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting name");
 
         // Insert Device ID into the root map
         err |= AddTextStringToMap(&rootMap, OC_RSRVD_DEVICE_ID, sizeof(OC_RSRVD_DEVICE_ID) - 1,
                 payload->sid);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting device id");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting device id");
 
         // Insert Resource Type
         err |= OCStringLLJoin(&rootMap, OC_RSRVD_RESOURCE_TYPE, payload->type);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting RT");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting RT");
 
         // Insert interfaces
         err |= OCStringLLJoin(&rootMap, OC_RSRVD_INTERFACE, payload->iface);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding interface types tag/value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding interface types tag/value");
 
         // Insert Links into the root map.
         CborEncoder linkArray;
         err |= cbor_encode_text_string(&rootMap, OC_RSRVD_LINKS, sizeof(OC_RSRVD_LINKS) - 1);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting links array tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting links array tag");
         size_t resourceCount =  OCDiscoveryPayloadGetResourceCount(payload);
         err |= cbor_encoder_create_array(&rootMap, &linkArray, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting links array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting links array");
 
         bool isSelf = false;
         const char *deviceId = OCGetServerInstanceIDString();
@@ -457,7 +457,7 @@ static int64_t OCConvertDiscoveryPayloadCbor(OCDiscoveryPayload *payload,
             if (isSelf || !resource->eps)
             {
                 err |= OCConvertResourcePayloadCbor(&linkArray, resource, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting links array");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting links array");
             }
             else
             {
@@ -466,24 +466,24 @@ static int64_t OCConvertDiscoveryPayloadCbor(OCDiscoveryPayload *payload,
                 {
                     OCEndpointPayload* ep = OCEndpointPayloadGetEndpoint(resource->eps, j);
                     err |= OCConvertResourcePayloadCbor(&linkArray, resource, ep);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting links array");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting links array");
                 }
             }
         }
 
         // Close links array inside the root map.
         err |= cbor_encoder_close_container(&rootMap, &linkArray);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing link array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing link array");
         // close root map inside the root array.
         err |= cbor_encoder_close_container(&rootArray, &rootMap);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root map");
 
         payload = payload->next;
     }
 
     // Close the final root array.
     err |= cbor_encoder_close_container(&encoder, &rootArray);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root array");
 
 exit:
     return checkError(err, &encoder, outPayload, size);
@@ -521,36 +521,36 @@ static int64_t OCConvertDiscoveryPayloadVndOcfCbor(OCDiscoveryPayload *payload,
     {
         // Open the root array
         err |= cbor_encoder_create_array(&encoder, &rootArray, 1);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating discovery root array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating discovery root array");
 
         // Open the root map
         err |= cbor_encoder_create_map(&rootArray, &rootMap, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating discovery map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating discovery map");
 
         // Insert Name
         err |= ConditionalAddTextStringToMap(&rootMap, OC_RSRVD_DEVICE_NAME,
                 sizeof(OC_RSRVD_DEVICE_NAME) - 1, payload->name);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting name");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting name");
 
         // Insert Resource Type
         err |= OCStringLLJoin(&rootMap, OC_RSRVD_RESOURCE_TYPE, payload->type);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting RT");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting RT");
 
         // Insert interfaces
         err |= OCStringLLJoin(&rootMap, OC_RSRVD_INTERFACE, payload->iface);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding interface types tag/value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding interface types tag/value");
 
         // Insert Links into the root map.
         err |= cbor_encode_text_string(&rootMap, OC_RSRVD_LINKS, sizeof(OC_RSRVD_LINKS) - 1);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting links array tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting links array tag");
 
         err |= cbor_encoder_create_array(&rootMap, &linkArray, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting links array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting links array");
     }
     else
     {
         err |= cbor_encoder_create_array(&encoder, &linkArray, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating discovery root array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating discovery root array");
     }
 
     while (payload && payload->resources)
@@ -563,56 +563,56 @@ static int64_t OCConvertDiscoveryPayloadVndOcfCbor(OCDiscoveryPayload *payload,
             // Open a link map in the root array
             CborEncoder linkMap;
             err |= cbor_encoder_create_map(&linkArray, &linkMap, CborIndefiniteLength);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating discovery map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating discovery map");
 
             // Uri
             err |= AddTextStringToMap(&linkMap, OC_RSRVD_HREF, sizeof(OC_RSRVD_HREF) - 1,
                                       resource->uri);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding uri to links map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding uri to links map");
 
             // Rel - Not a mandatory field
             err |= ConditionalAddTextStringToMap(&linkMap, OC_RSRVD_REL, sizeof(OC_RSRVD_REL) - 1,
                                                  resource->rel);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rel to links map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rel to links map");
 
             // Anchor
             char anchor[MAX_URI_LENGTH];
             int snRet = snprintf(anchor, MAX_URI_LENGTH, "ocf://%s", payload->sid);
             if(0 > snRet || snRet >= MAX_URI_LENGTH)
             {
-                VERIFY_CBOR_SUCCESS(TAG, CborErrorInternalError, "Error (snprintf)");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, CborErrorInternalError, "Error (snprintf)");
             }
 
             err |= AddTextStringToMap(&linkMap, OC_RSRVD_URI, sizeof(OC_RSRVD_URI) - 1, anchor);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding anchor to links map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding anchor to links map");
 
             // Resource Type
             err |= OCStringLLJoin(&linkMap, OC_RSRVD_RESOURCE_TYPE, resource->types);
-            VERIFY_CBOR_SUCCESS(TAG, err,
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err,
                                 "Failed adding resourceType tag/value to links map");
 
             // Interface Types
             err |= OCStringLLJoin(&linkMap, OC_RSRVD_INTERFACE, resource->interfaces);
-            VERIFY_CBOR_SUCCESS(TAG, err,
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err,
                                 "Failed adding interfaces tag/value to links map");
 
             // Policy
             CborEncoder policyMap;
             err |= cbor_encode_text_string(&linkMap, OC_RSRVD_POLICY,
                                            sizeof(OC_RSRVD_POLICY) - 1);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding policy tag to links map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding policy tag to links map");
             err |= cbor_encoder_create_map(&linkMap, &policyMap, CborIndefiniteLength);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding policy map to links map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding policy map to links map");
 
             // Bitmap
             err |=  cbor_encode_text_string(&policyMap, OC_RSRVD_BITMAP,
                                             sizeof(OC_RSRVD_BITMAP) - 1);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding bitmap tag to policy map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding bitmap tag to policy map");
             err |= cbor_encode_uint(&policyMap, resource->bitmap);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding bitmap value to policy map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding bitmap value to policy map");
 
             err |= cbor_encoder_close_container(&linkMap, &policyMap);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing policy map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing policy map");
 
             // Endpoints
             size_t epsCount = OCEndpointPayloadGetEndpointCount(resource->eps);
@@ -623,10 +623,10 @@ static int64_t OCConvertDiscoveryPayloadVndOcfCbor(OCDiscoveryPayload *payload,
                 CborEncoder epsArray;
                 err |= cbor_encode_text_string(&linkMap, OC_RSRVD_ENDPOINTS,
                                                sizeof(OC_RSRVD_ENDPOINTS) - 1);
-                VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting endpoints array tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting endpoints array tag");
 
                 err |= cbor_encoder_create_array(&linkMap, &epsArray, epsCount);
-                VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting endpoints array");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting endpoints array");
 
                 for (size_t j = 0; j < epsCount; ++j)
                 {
@@ -638,30 +638,30 @@ static int64_t OCConvertDiscoveryPayloadVndOcfCbor(OCDiscoveryPayload *payload,
                     VERIFY_PARAM_NON_NULL(TAG, endpointStr, "Failed creating endpoint string");
 
                     err |= cbor_encoder_create_map(&epsArray, &endpointMap, EP_MAP_LEN);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating endpoint map");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating endpoint map");
 
                     err |= AddTextStringToMap(&endpointMap, OC_RSRVD_ENDPOINT,
                                               sizeof(OC_RSRVD_ENDPOINT) - 1, endpointStr);
                     OICFree(endpointStr);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding endpoint to endpoint map");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding endpoint to endpoint map");
 
                     err |= cbor_encode_text_string(&endpointMap, OC_RSRVD_PRIORITY,
                                                    sizeof(OC_RSRVD_PRIORITY) - 1);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding priority tag to endpoint map");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding priority tag to endpoint map");
                     err |= cbor_encode_uint(&endpointMap, endpoint->pri);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding priority value to endpoint map");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding priority value to endpoint map");
 
                     err |= cbor_encoder_close_container(&epsArray, &endpointMap);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing endpoint map");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing endpoint map");
                 }
 
                 err |= cbor_encoder_close_container(&linkMap, &epsArray);
-                VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing endpoints map");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing endpoints map");
             }
 
             // Finished encoding a resource, close the map.
             err |= cbor_encoder_close_container(&linkArray, &linkMap);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing link map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing link map");
         }
 
         payload = payload->next;
@@ -671,21 +671,21 @@ static int64_t OCConvertDiscoveryPayloadVndOcfCbor(OCDiscoveryPayload *payload,
     {
         // Close the link array instead the root map.
         err |= cbor_encoder_close_container(&rootMap, &linkArray);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root array");
 
         // Close root map inside the root array.
         err |= cbor_encoder_close_container(&rootArray, &rootMap);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root map");
 
         // Close the final root array.
         err |= cbor_encoder_close_container(&encoder, &rootArray);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root map");
     }
     else
     {
         // Close the final root array.
         err |= cbor_encoder_close_container(&encoder, &linkArray);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root array");
     }
 
 exit:
@@ -765,14 +765,14 @@ static int64_t OCConvertArray(CborEncoder *parent, const OCRepPayloadValueArray
     int64_t err = CborNoError;
     CborEncoder array;
     err |= cbor_encoder_create_array(parent, &array, valArray->dimensions[0]);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating rep array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating rep array");
     for (size_t i = 0; i < valArray->dimensions[0]; ++i)
     {
         if (0 != valArray->dimensions[1])
         {
             CborEncoder array2;
             err |= cbor_encoder_create_array(&array, &array2, valArray->dimensions[1]);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating rep array2");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating rep array2");
 
             for (size_t j = 0; j < valArray->dimensions[1]; ++j)
             {
@@ -780,7 +780,7 @@ static int64_t OCConvertArray(CborEncoder *parent, const OCRepPayloadValueArray
                 {
                     CborEncoder array3;
                     err |= cbor_encoder_create_array(&array2, &array3, valArray->dimensions[2]);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating rep array3");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating rep array3");
 
                     for(size_t k = 0; k < valArray->dimensions[2]; ++k)
                     {
@@ -788,28 +788,28 @@ static int64_t OCConvertArray(CborEncoder *parent, const OCRepPayloadValueArray
                                 j * valArray->dimensions[2] +
                                 i * valArray->dimensions[2] * valArray->dimensions[1] +
                                 k);
-                        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rep array3 value");
+                        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rep array3 value");
                     }
                     err |= cbor_encoder_close_container(&array2, &array3);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing rep array3");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing rep array3");
                 }
                 else
                 {
                     err |= OCConvertArrayItem(&array2, valArray, i * valArray->dimensions[1] + j);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rep array2 value");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rep array2 value");
                 }
             }
             err |= cbor_encoder_close_container(&array, &array2);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing rep array2");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing rep array2");
         }
         else
         {
             err |= OCConvertArrayItem(&array, valArray, i);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rep array value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rep array value");
         }
     }
     err |= cbor_encoder_close_container(parent, &array);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing rep array");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing rep array");
 
 exit:
     return err;
@@ -839,23 +839,23 @@ static int64_t OCConvertRepMap(CborEncoder *map, const OCRepPayload *payload)
     if (value)
     {
         err |= cbor_encoder_create_map(map, &encoder, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating rep map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating rep map");
         err |= OCConvertSingleRepPayload(&encoder, payload);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed converting single rep payload");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed converting single rep payload");
         err |= cbor_encoder_close_container(map, &encoder);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing rep map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing rep map");
     }
     else
     {
         err |= cbor_encoder_create_array(map, &encoder, arrayLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating rep map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating rep map");
         for (value = payload->values; value; value = value->next)
         {
             err |= OCConvertSingleRepPayloadValue(&encoder, value);
-            VERIFY_CBOR_SUCCESS(TAG, err, "Failed converting single rep value");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed converting single rep value");
         }
         err |= cbor_encoder_close_container(map, &encoder);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing rep map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing rep map");
     }
 
 exit:
@@ -908,30 +908,30 @@ static int64_t OCConvertSingleRepPayload(CborEncoder *repMap, const OCRepPayload
     {
         OIC_LOG(INFO, TAG, "Payload has uri");
         err |= cbor_encode_text_string(repMap, OC_RSRVD_HREF, strlen(OC_RSRVD_HREF));
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rep href tag");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rep href tag");
         err |= cbor_encode_text_string(repMap, payload->uri, strlen(payload->uri));
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rep href value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rep href value");
     }
     if (payload->types)
     {
         OIC_LOG(INFO, TAG, "Payload has types");
         err |= OCStringLLJoin(repMap, OC_RSRVD_RESOURCE_TYPE, payload->types);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding resource type.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding resource type.");
     }
     if (payload->interfaces)
     {
         OIC_LOG(INFO, TAG, "Payload has interfaces");
         err |= OCStringLLJoin(repMap, OC_RSRVD_INTERFACE, payload->interfaces);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding platform interface type.");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding platform interface type.");
     }
     OCRepPayloadValue *value = payload->values;
     while (value)
     {
         err |= cbor_encode_text_string(repMap, value->name, strlen(value->name));
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding tag name");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding tag name");
 
         err |= OCConvertSingleRepPayloadValue(repMap, value);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding single rep value");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding single rep value");
         value = value->next;
     }
 
@@ -955,7 +955,7 @@ static int64_t OCConvertRepPayload(OCRepPayload *payload, uint8_t *outPayload, s
     if (arrayCount > 1)
     {
         err |= cbor_encoder_create_array(&encoder, &rootArray, arrayCount);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding rep root map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding rep root map");
     }
 
     while (payload != NULL && (err == CborNoError))
@@ -963,21 +963,21 @@ static int64_t OCConvertRepPayload(OCRepPayload *payload, uint8_t *outPayload, s
         CborEncoder rootMap;
         err |= cbor_encoder_create_map(((arrayCount == 1)? &encoder: &rootArray),
                                             &rootMap, CborIndefiniteLength);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating root map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating root map");
 
         err |= OCConvertSingleRepPayload(&rootMap, payload);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed setting rep payload");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed setting rep payload");
 
         // Close main array
         err |= cbor_encoder_close_container(((arrayCount == 1) ? &encoder: &rootArray),
                 &rootMap);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root map");
         payload = payload->next;
     }
     if (arrayCount > 1)
     {
         err |= cbor_encoder_close_container(&encoder, &rootArray);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing root array");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing root array");
     }
 
 exit:
@@ -993,37 +993,37 @@ static int64_t OCConvertPresencePayload(OCPresencePayload *payload, uint8_t *out
     cbor_encoder_init(&encoder, outPayload, *size, 0);
     CborEncoder map;
     err |= cbor_encoder_create_map(&encoder, &map, CborIndefiniteLength);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed creating presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed creating presence map");
 
     // Sequence Number
     err |= cbor_encode_text_string(&map, OC_RSRVD_NONCE, sizeof(OC_RSRVD_NONCE) - 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding nonce tag to presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding nonce tag to presence map");
     err |= cbor_encode_uint(&map, payload->sequenceNumber);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding nonce value to presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding nonce value to presence map");
 
     // Max Age
     err |= cbor_encode_text_string(&map, OC_RSRVD_TTL, sizeof(OC_RSRVD_TTL) - 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding ttl tag to presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding ttl tag to presence map");
     err |= cbor_encode_uint(&map, payload->maxAge);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding ttl value to presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding ttl value to presence map");
 
     // Trigger
     err |= cbor_encode_text_string(&map, OC_RSRVD_TRIGGER, sizeof(OC_RSRVD_TRIGGER) - 1);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding trigger tag to presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding trigger tag to presence map");
     err |= cbor_encode_simple_value(&map, payload->trigger);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding trigger value to presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding trigger value to presence map");
 
     // Resource type name
     if (payload->trigger != OC_PRESENCE_TRIGGER_DELETE)
     {
         err |= ConditionalAddTextStringToMap(&map, OC_RSRVD_RESOURCE_TYPE,
                 sizeof(OC_RSRVD_RESOURCE_TYPE) - 1, payload->resourceType);
-        VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding resource type to presence map");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding resource type to presence map");
     }
 
     // Close Map
     err |= cbor_encoder_close_container(&encoder, &map);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed closing presence map");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed closing presence map");
 
 exit:
     return checkError(err, &encoder, outPayload, size);
@@ -1039,7 +1039,7 @@ static int64_t OCConvertDiagnosticPayload(OCDiagnosticPayload *payload, uint8_t
 
     // Message
     err |= cbor_encode_text_string(&encoder, payload->message, strlen(payload->message));
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed adding message");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed adding message");
 
 exit:
     return checkError(err, &encoder, outPayload, size);
index 91f2f01..07cd381 100644 (file)
@@ -69,7 +69,7 @@ OCStackResult OCParsePayload(OCPayload **outPayload, OCPayloadFormat payloadForm
     CborValue rootValue;
 
     err = cbor_parser_init(payload, payloadSize, 0, &parser, &rootValue);
-    VERIFY_CBOR_SUCCESS(TAG, err, "Failed initializing init value")
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "Failed initializing init value")
 
     switch(payloadType)
     {
@@ -136,19 +136,19 @@ static CborError OCParseStringLL(CborValue *map, char *type, OCStringLL **resour
 {
     CborValue val;
     CborError err = cbor_value_map_find_value(map, type, &val);
-    VERIFY_CBOR_SUCCESS(TAG, err, "to find StringLL TAG");
+    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find StringLL TAG");
 
     if (cbor_value_is_array(&val))
     {
         CborValue txtStr;
         err = cbor_value_enter_container(&val, &txtStr);
-        VERIFY_CBOR_SUCCESS(TAG, err, "to enter container");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to enter container");
         while (cbor_value_is_text_string(&txtStr))
         {
             size_t len = 0;
             char *input = NULL;
             err = cbor_value_dup_text_string(&txtStr, &input, &len, NULL);
-            VERIFY_CBOR_SUCCESS(TAG, err, "to find StringLL value.");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find StringLL value.");
             if (input)
             {
                 char *savePtr = NULL;
@@ -170,7 +170,7 @@ static CborError OCParseStringLL(CborValue *map, char *type, OCStringLL **resour
             if (cbor_value_is_text_string(&txtStr))
             {
                 err = cbor_value_advance(&txtStr);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to advance string value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to advance string value");
             }
         }
     }
@@ -200,7 +200,7 @@ static OCStackResult OCParseDiscoveryPayloadCbor(OCPayload **outPayload,
         // Enter the main root map
         ret = OC_STACK_MALFORMED_RESPONSE;
         err = cbor_value_enter_container(rootValue, &rootMap);
-        VERIFY_CBOR_SUCCESS(TAG, err, "to enter root map container");
+        VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to enter root map container");
         while (cbor_value_is_map(&rootMap))
         {
             ret = OC_STACK_NO_MEMORY;
@@ -210,18 +210,18 @@ static OCStackResult OCParseDiscoveryPayloadCbor(OCPayload **outPayload,
             // Look for DI
             CborValue curVal;
             err = cbor_value_map_find_value(&rootMap, OC_RSRVD_DEVICE_ID, &curVal);
-            VERIFY_CBOR_SUCCESS(TAG, err, "to find device id tag");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find device id tag");
             if (cbor_value_is_valid(&curVal))
             {
                 if (cbor_value_is_byte_string(&curVal))
                 {
                     err = cbor_value_dup_byte_string(&curVal, (uint8_t **)&(temp->sid), &len, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "to copy device id value");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to copy device id value");
                 }
                 else if (cbor_value_is_text_string(&curVal))
                 {
                     err = cbor_value_dup_text_string(&curVal, &(temp->sid), &len, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "to copy device id value");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to copy device id value");
                 }
             }
 
@@ -230,7 +230,7 @@ static OCStackResult OCParseDiscoveryPayloadCbor(OCPayload **outPayload,
             if (cbor_value_is_valid(&curVal))
             {
                 err = OCParseStringLL(&rootMap, OC_RSRVD_RESOURCE_TYPE, &temp->type);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find resource type");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find resource type");
             }
 
             // IF - Not a mandatory field
@@ -238,7 +238,7 @@ static OCStackResult OCParseDiscoveryPayloadCbor(OCPayload **outPayload,
             if (cbor_value_is_valid(&curVal))
             {
                 err =  OCParseStringLL(&rootMap, OC_RSRVD_INTERFACE, &temp->iface);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find interface");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find interface");
             }
 
             // Name - Not a mandatory field
@@ -246,21 +246,21 @@ static OCStackResult OCParseDiscoveryPayloadCbor(OCPayload **outPayload,
             if (cbor_value_is_text_string(&curVal))
             {
                 err = cbor_value_dup_text_string(&curVal, &temp->name, &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find device name");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find device name");
             }
 
             // Look for Links which will have an array as the value
             CborValue linkMap;
             err = cbor_value_map_find_value(&rootMap, OC_RSRVD_LINKS, &linkMap);
-            VERIFY_CBOR_SUCCESS(TAG, err, "to find links tag");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find links tag");
             err = cbor_value_is_valid(&linkMap) ? CborNoError : CborUnknownError;
-            VERIFY_CBOR_SUCCESS(TAG, err, "to find links tag");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find links tag");
 
             // Enter the links array and start iterating through the array processing
             // each resource which shows up as a map.
             CborValue resourceMap;
             err = cbor_value_enter_container(&linkMap, &resourceMap);
-            VERIFY_CBOR_SUCCESS(TAG, err, "to enter link map");
+            VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to enter link map");
 
             while (cbor_value_is_map(&resourceMap))
             {
@@ -271,24 +271,24 @@ static OCStackResult OCParseDiscoveryPayloadCbor(OCPayload **outPayload,
 
                 // Uri
                 err = cbor_value_map_find_value(&resourceMap, OC_RSRVD_HREF, &curVal);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find href tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find href tag");
                 err = cbor_value_is_valid(&curVal) ? CborNoError : CborUnknownError;
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find href tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find href tag");
                 err = cbor_value_dup_text_string(&curVal, &(resource->uri), &len, NULL);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find href value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find href value");
 
                 // Rel - Not a mandatory field
                 err = cbor_value_map_find_value(&resourceMap, OC_RSRVD_REL, &curVal);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find rel tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find rel tag");
                 if (cbor_value_is_valid(&curVal))
                 {
                     err = cbor_value_dup_text_string(&curVal, &(resource->rel), &len, NULL);
-                    VERIFY_CBOR_SUCCESS(TAG, err, "to find rel value");
+                    VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find rel value");
                 }
 
                 // Resource Types
                 err =  OCParseStringLL(&resourceMap, OC_RSRVD_RESOURCE_TYPE, &resource->types);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find resource type tag/value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find resource type tag/value");
 
                 // Interface Types
                 err =  OCParseStringLL(&resourceMap, OC_RSRVD_INTERFACE, &resource->interfaces);
@@ -305,37 +305,37 @@ static OCStackResult OCParseDiscoveryPayloadCbor(OCPayload **outPayload,
                 // Policy
                 CborValue policyMap;
                 err = cbor_value_map_find_value(&resourceMap, OC_RSRVD_POLICY, &policyMap);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find policy tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find policy tag");
                 err = cbor_value_is_valid(&policyMap) ? CborNoError : CborUnknownError;
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find policy tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find policy tag");
 
                 // Bitmap
                 err = cbor_value_map_find_value(&policyMap, OC_RSRVD_BITMAP, &curVal);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find bitmap tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find bitmap tag");
                 err = cbor_value_is_valid(&curVal) ? CborNoError : CborUnknownError;
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find bitmap tag");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find bitmap tag");
                 err = cbor_value_get_int(&curVal, &bitmap);
-                VERIFY_CBOR_SUCCESS(TAG, err, "to find bitmap value");
+                VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, err, "to find bitmap value");
                 resource->bitmap = (uint8_t)bitmap;
 
                 // Secure Flag