From c533da5f0436de645868fdb181fb795025dc6de0 Mon Sep 17 00:00:00 2001 From: "saurabh.s9" Date: Sat, 20 May 2017 18:45:28 +0530 Subject: [PATCH] [IOT-2124] added NULL check after OICCalloc Change-Id: I4013385beb5ba13fe8830f6b64a20f9562f0bdbf Signed-off-by: saurabh.s9 Reviewed-on: https://gerrit.iotivity.org/gerrit/20175 Tested-by: jenkins-iotivity Reviewed-by: Randeep Singh --- resource/csdk/security/src/pstatresource.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resource/csdk/security/src/pstatresource.c b/resource/csdk/security/src/pstatresource.c index a27e537..01ae91c 100644 --- a/resource/csdk/security/src/pstatresource.c +++ b/resource/csdk/security/src/pstatresource.c @@ -627,6 +627,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, pstat->smLen = 1; 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."); pstat->sm[0] = (OicSecDpom_t)sm; @@ -644,6 +645,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, VERIFY_NOT_NULL(TAG, gPstat, ERROR); pstat->smLen = gPstat->smLen; pstat->sm = (OicSecDpom_t*)OICCalloc(pstat->smLen, sizeof(OicSecDpom_t)); + VERIFY_NOT_NULL(TAG, pstat->sm, ERROR); *pstat->sm = *gPstat->sm; cborFindResult = CborNoError; } -- 2.7.4