memory leaks fix 20/29320/3
authorOleksandr Dmytrenko <o.dmytrenko@samsung.com>
Wed, 6 Mar 2019 16:08:06 +0000 (18:08 +0200)
committerAleksey Volkov <a.volkov@samsung.com>
Mon, 11 Mar 2019 09:22:49 +0000 (09:22 +0000)
==29556== 68 (64 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 291 of 568
==29556==    at 0x4837B85: calloc (vg_replace_malloc.c:752)
==29556==    by 0x36FE93: OICCalloc (oic_malloc.c:102)
==29556==    by 0x2DB355: CBORPayloadToPstatBin (pstatresource.c:450)
==29556==    by 0x2DB160: CBORPayloadToPstat (pstatresource.c:418)
==29556==    by 0x232EA7: ListMethodsHandler (ownershiptransfermanager.c:1073)

Change-Id: I882b145c0ccf86dfce3736fc24e3c3949a3f00ee
Signed-off-by: Oleksandr Dmytrenko <o.dmytrenko@samsung.com>
resource/csdk/security/provisioning/src/ownershiptransfermanager.c

index de3de17..46bd4e5 100644 (file)
@@ -1084,6 +1084,8 @@ static OCStackApplicationResult ListMethodsHandler(void *ctx, OCDoHandle UNUSED,
         {
             OIC_LOG(ERROR, TAG, "Device pairing mode enabling owner transfer operations is disabled");
             SetResult(otmCtx, OC_STACK_ERROR);
+            OICFree(pstat->sm);
+            OICFree(pstat);
             return OC_STACK_DELETE_TRANSACTION;
         }
         otmCtx->selectedDeviceInfo->pstat = pstat;