Bugzilla – Full Text Bug Listing |
Summary: | Free a variable is not defined as a pointer | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Long Li <lilong> |
Component: | openflow | Assignee: | Blake Hurd <naimorai> |
Status: | PATCH PENDING --- | ||
Severity: | normal | CC: | lilong, ns-bugs, tomh |
Priority: | P5 | ||
Version: | ns-3.15 | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: | comments statement free(cb) in function OpenFlowSwitchNetDevice::StatsDone(ofi::StatsDumpCallback *cb), and add statements free(cb->rq) in the same function |
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".