[CONPRO-1172] allocates too much memory
[platform/upstream/iotivity.git] / resource / csdk / stack / src / ocstack.c
index cee39e4..f588187 100644 (file)
@@ -1789,12 +1789,9 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
      * proper destination and remove "RM" coap header option before passing request / response to
      * RI as this option will make no sense to either RI or application.
      */
-    if (responseInfo->info.options)
-    {
-        RMUpdateInfo((CAHeaderOption_t **) &(responseInfo->info.options),
+    RMUpdateInfo((CAHeaderOption_t **) &(responseInfo->info.options),
                  (uint8_t *) &(responseInfo->info.numOptions),
                  (CAEndpoint_t *) endPoint);
-    }
 #endif
 
     OCHandleResponse(endPoint, responseInfo);
@@ -2240,12 +2237,6 @@ void OCHandleRequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque
     {
         OIC_LOG_V(ERROR, TAG, "HandleStackRequests failed. error: %d", requestResult);
 
-        // Delete observer node if it is OBSERVE failure from app
-        if (serverRequest.observationOption == OC_OBSERVE_REGISTER)
-        {
-            DeleteObserverUsingToken(requestInfo->info.token, requestInfo->info.tokenLength);
-        }
-
         CAResponseResult_t stackResponse =
             OCToCAStackResult(requestResult, serverRequest.method);
 
@@ -2306,12 +2297,9 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque
      * Put source in sender endpoint so that the next packet from application can be routed to
      * proper destination and remove RM header option.
      */
-    if (requestInfo->info.options)
-    {
-        RMUpdateInfo((CAHeaderOption_t **) &(requestInfo->info.options),
+    RMUpdateInfo((CAHeaderOption_t **) &(requestInfo->info.options),
                  (uint8_t *) &(requestInfo->info.numOptions),
                  (CAEndpoint_t *) endPoint);
-    }
 
 #ifdef ROUTING_GATEWAY
     if (isEmptyMsg)