Fix CA invalid free memory bug
authorShilpa Sodani <shilpa.a.sodani@intel.com>
Thu, 26 Feb 2015 22:17:20 +0000 (14:17 -0800)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Fri, 27 Feb 2015 09:01:37 +0000 (09:01 +0000)
Fixed the if-statement for freeing header options

Change-Id: I13e809b805cb94495aa7487dfb6ed1ca4bd53396
Signed-off-by: Shilpa Sodani <shilpa.a.sodani@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/413
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
resource/csdk/connectivity/src/caremotehandler.c

index b103fcb..c1b4a4f 100644 (file)
@@ -485,7 +485,7 @@ void CADestroyResponseInfoInternal(CAResponseInfo_t *rep)
     }
 
     // free options field
-    if (rep->info.options != NULL)
+    if (rep->info.options != NULL && rep->info.numOptions)
     {
         OICFree((CAHeaderOption_t *) rep->info.options);
     }