From 3f411afbca9fa8156c44f96348c77660738806f7 Mon Sep 17 00:00:00 2001 From: youngman Date: Fri, 12 Aug 2016 16:20:33 +0900 Subject: [PATCH] (double free) crash occurred when discovering device Change-Id: I5ae6cbe8e62e5b0aeb0dd34a5d239cc7761b2ea9 Signed-off-by: youngman Reviewed-on: https://gerrit.iotivity.org/gerrit/10331 Tested-by: jenkins-iotivity Reviewed-by: Youngjae Shin Reviewed-by: Randeep Singh --- resource/csdk/security/provisioning/include/pmutility.h | 2 +- resource/csdk/security/provisioning/src/ocprovisioningmanager.c | 2 +- resource/csdk/security/provisioning/src/pmutility.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resource/csdk/security/provisioning/include/pmutility.h b/resource/csdk/security/provisioning/include/pmutility.h index c36b204..2a64248 100644 --- a/resource/csdk/security/provisioning/include/pmutility.h +++ b/resource/csdk/security/provisioning/include/pmutility.h @@ -109,7 +109,7 @@ void PMPrintOCProvisionDev(const OCProvisionDev_t* pDev); * @return true when deletion is happened, false when no deletion is occured. In case either of * two arguments is null it will return false. */ -bool PMDeleteFromUUIDList(OCUuidList_t *pUuidList, OicUuid_t *targetId); +bool PMDeleteFromUUIDList(OCUuidList_t **pUuidList, OicUuid_t *targetId); #ifdef __cplusplus } diff --git a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c index 85974cf..ae2f054 100644 --- a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c +++ b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c @@ -891,7 +891,7 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, size_t deleteCnt = 0; while (pCurDev) { - if(true == PMDeleteFromUUIDList(uuidList, &pCurDev->doxm->deviceID)) + if(true == PMDeleteFromUUIDList(&uuidList, &pCurDev->doxm->deviceID)) { deleteCnt++; } diff --git a/resource/csdk/security/provisioning/src/pmutility.c b/resource/csdk/security/provisioning/src/pmutility.c index b72c28c..7ce7bc8 100644 --- a/resource/csdk/security/provisioning/src/pmutility.c +++ b/resource/csdk/security/provisioning/src/pmutility.c @@ -929,18 +929,18 @@ void PMPrintOCProvisionDev(const OCProvisionDev_t* pDev) } } -bool PMDeleteFromUUIDList(OCUuidList_t *pUuidList, OicUuid_t *targetId) +bool PMDeleteFromUUIDList(OCUuidList_t **pUuidList, OicUuid_t *targetId) { - if(pUuidList == NULL || targetId == NULL) + if(*pUuidList == NULL || targetId == NULL) { return false; } OCUuidList_t *tmp1 = NULL,*tmp2=NULL; - LL_FOREACH_SAFE(pUuidList, tmp1, tmp2) + LL_FOREACH_SAFE(*pUuidList, tmp1, tmp2) { if(0 == memcmp(tmp1->dev.id, targetId->id, sizeof(targetId->id))) { - LL_DELETE(pUuidList, tmp1); + LL_DELETE(*pUuidList, tmp1); OICFree(tmp1); return true; } -- 2.7.4