Memory leak in GetDerCrl() fixed
Change-Id: Iddf0628c73d69ce8beafa66b09b4b2f2e61e8006
Signed-off-by: Oleksii Beketov <ol.beketov@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16439
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dmitriy Zhuravlev <d.zhuravlev@samsung.com>
Reviewed-by: Chul Lee <chuls.lee@samsung.com>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
(cherry picked from commit
e43d061497721cfe8fbfef623c3c4d5ae2556ce7)
Reviewed-on: https://gerrit.iotivity.org/gerrit/17059
{
OIC_LOG (ERROR, TAG, "Base64 decoding failed.");
}
+ OICFree(out);
}
out->len = 0;
- out->data = OICMalloc(crl->len);
+ out->data = OICRealloc(out->data, crl->len);
if (out->data)
{
memcpy(out->data, crl->data, crl->len);
//GetDerCrl Tests
TEST(CRLResourceTest, GetDerCrl)
{
-#define CRL_MAX_LEN 1024
- uint8_t crlData[CRL_MAX_LEN] = {0};
- ByteArray crlArray = {crlData, CRL_MAX_LEN};
+ ByteArray crlArray = {NULL, 0};
GetDerCrl(&crlArray);
EXPECT_NE(0, crlArray.len);
}