[IOT-1805] Fix SSL session leak on error
authorDan Mihai <Daniel.Mihai@microsoft.com>
Tue, 7 Feb 2017 22:47:56 +0000 (14:47 -0800)
committerKevin Kane <kkane@microsoft.com>
Tue, 14 Feb 2017 01:13:40 +0000 (01:13 +0000)
The SSL session is always using the secure port - never the unsecured
port.

Change-Id: If4f490a720dc1943404f9364230ba1de1e232133
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17099
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Kevin Kane <kkane@microsoft.com>
resource/csdk/security/provisioning/src/ownershiptransfermanager.c

index f631d52..d911187 100755 (executable)
@@ -464,8 +464,11 @@ static void SetResult(OTMContext_t* otmCtx, const OCStackResult res)
                 {
                     OIC_LOG(WARNING, TAG, "Internal error in PDMDeleteDevice");
                 }
+
                 CAEndpoint_t endpoint;
                 memcpy(&endpoint, &(otmCtx->selectedDeviceInfo->endpoint), sizeof(CAEndpoint_t));
+                endpoint.port = otmCtx->selectedDeviceInfo->securePort;
+
                 if (CA_STATUS_OK != CAcloseSslConnection(&endpoint))
                 {
                     OIC_LOG(WARNING, TAG, "Failed to close Secure session");