Bugzilla – Bug 1553
Free a variable is not defined as a pointer
Last modified: 2013-04-26 14:09:47 EDT
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".