Fix crash issue after observation
authorErich Keane <erich.keane@intel.com>
Tue, 4 Nov 2014 00:42:20 +0000 (16:42 -0800)
committerErich Keane <erich.keane@intel.com>
Tue, 4 Nov 2014 00:44:01 +0000 (16:44 -0800)
I discovered a crash in simpleserver C++ that when being debugged,
it would crash on the observation AFTER the client had cancelled.
The cause was that the NumberRecvHeaderOptions sent was an invalid
character rather than 0!  This fix repairs the issue by ensuring that
the values are initialized correctly.

Change-Id: I35a0a0aa45d356208f1cd563f3558997665881db
Signed-off-by: Erich Keane <erich.keane@intel.com>
csdk/occoap/src/occoaphelper.c

index 829e807..351281e 100644 (file)
@@ -396,6 +396,9 @@ OCStackResult FormOCEntityHandlerRequest(OCEntityHandlerRequest * entityHandlerR
 
         entityHandlerRequestLoc->obsInfo = NULL;
         entityHandlerRequestLoc->newResourceUri = newResUriBuf;
+
+        entityHandlerRequestLoc->numRcvdVendorSpecificHeaderOptions = 0;
+        entityHandlerRequestLoc->numSendVendorSpecificHeaderOptions = 0;
         return OC_STACK_OK;
     }