Bug 1553 - Free a variable is not defined as a pointer
Free a variable is not defined as a pointer
Status: PATCH PENDING
Product: ns-3
Classification: Unclassified
Component: openflow
ns-3.15
PC Linux
: P5 normal
Assigned To: Blake Hurd
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-13 08:15 EST by Long Li
Modified: 2013-04-26 14:09 EDT (History)
3 users (show)

See Also:


Attachments
comments statement free(cb) in function OpenFlowSwitchNetDevice::StatsDone(ofi::StatsDumpCallback *cb), and add statements free(cb->rq) in the same function (555 bytes, application/octet-stream)
2012-12-13 08:15 EST, Long Li
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Long Li 2012-12-13 08:15:58 EST
Created attachment 1486 [details]
comments statement free(cb) in function OpenFlowSwitchNetDevice::StatsDone(ofi::StatsDumpCallback *cb), and add statements free(cb->rq) in the same function

In function OpenFlowSwitchNetDevice::StatsDone(ofi::StatsDumpCallback *cb) defined in source file openflow-switch-net-device.cc, it free the parameter cb with statement free(cb). The original definition of cb appears in function OpenFlowSwitchNetDevice::ReceiveStatsRequest (const void *oh) in the same file, using statement ofi::StatsDumpCallback cb, and passes it down to function StartDump with statement m_controller->StartDump (&cb). So there is no need to free it in function StatsDone.

And we also need to free the rq field of cb with statement free(cb->rq) in function OpenFlowSwitchNetDevice::StatsDone();

Steps to Reproduce:
   When writes code to query individual flow statistic with OpenFlow, the program will crash with a error "double free".