[IOT-1434] Fix memory leak related server request List.
authorjihwan.seo <jihwan.seo@samsung.com>
Fri, 7 Oct 2016 10:54:44 +0000 (19:54 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Mon, 10 Oct 2016 12:04:16 +0000 (12:04 +0000)
when there is no response data for virtual reqeust in server.
it should be removed, since it never remove and
causes a big memory leak.

Change-Id: Ic65692ae8b2c1c27f554f466d00bd0cc1674118f
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12947
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/csdk/stack/src/ocresource.c

index 2f1a964..35fd4be 100755 (executable)
@@ -852,6 +852,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
             SendDirectStackResponse(&endpoint, request->coapID, CA_EMPTY, CA_MSG_ACKNOWLEDGE,
                                     0, NULL, NULL, 0, NULL, CA_RESPONSE_FOR_RES);
         }
+        FindAndDeleteServerRequest(request);
 
         // Presence uses observer notification api to respond via SendPresenceNotification.
         SendPresenceNotification(resource->rsrcType, OC_PRESENCE_TRIGGER_CHANGE);
@@ -880,6 +881,8 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
         {
             // Ignoring the discovery request as per RFC 7252, Section #8.2
             OIC_LOG(INFO, TAG, "Silently ignoring the request since no useful data to send. ");
+            // the request should be removed. since it never remove and causes a big memory waste.
+            FindAndDeleteServerRequest(request);
         }
     }