Hi,
I am developing test application. The sample application is :
++++++++++++++++++++++++++++++++++++++++++++
Code:
#include <fluid/of10msg.hh>
#include <iostream>
#include <fluid/of10msg.hh>
#include <fluid/of10/openflow-10.h>
using namespace fluid_msg;
of10::PacketOut packet_generation()
{
of10::PacketOut po(1,of10::OFP_NO_BUFFER,of10::OFPP_CONTROLLER);
of10::OutputAction act(1, 1024); // = new of13::OutputAction();
po.add_action(act);
std::vector<uint8_t> buf={100,20,30,56,67,78,98};
po.data(buf.data(), buf.size());
return po;
}
int main() {
// int a[2] = {1, 0};
// int b=a[2];
std::vector<std::unique_ptr<of10::PacketOut>> vec;
//={} ;
std::cout<<"Test" << std::endl;
for (int i=0; i<3; i++)
{
//of10::PacketOut p1=packet_generation();
std::unique_ptr<of10::PacketOut> ptr=std::make_unique<of10::PacketOut>(packet_generation());
vec.push_back(std::move(ptr));
}
std::cout<< "finished" << std::endl;
return 1;
}
++++++++++++++++++++++++++++++++++++++++++++++
When I compile with g++-6 with -g -fsanitize=address option. It compiled well and could nt run. It gives some errors messages:
Test
finished
================================================== ===============
==3908==ERROR: AddressSanitizer: attempting double-free on 0x60200000efb0 in thread T0:
#0 0x7f00bdf57630 in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc8630)
#1 0x7f00bdc50121 in fluid_msg::PacketOutCommon::~PacketOutCommon() fluid/ofcommon/msg.cc:308
/c++/6/bits/stl_vector.h:426
#11 0x4020c5 in main /home/sothy/netbricks/bitbucket/ofd/test/test2.cc:40
#12 0x7f00bd29582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#13 0x401a08 in _start (/home/sothy/netbricks/bitbucket/ofd/test/test2+0x401a08)
0x60200000efb0 is located 0 bytes inside of 7-byte region [0x60200000efb0,0x60200000efb7)
freed by thread T0 here:
#0 0x7f00bdf57630 in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc8630)
#1 0x7f00bdc50121 in fluid_msg::PacketOutCommon::~PacketOutCommon() fluid/ofcommon/msg.cc:308
#2 0x402054 in main /home/sothy/netbricks/bitbucket/ofd/test/test2.cc:47
#3 0x7f00bd29582f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
previously allocated by thread T0 here:
#0 0x7f00bdf56fb0 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc7fb0)
#1 0x7f00bdc50a24 in fluid_msg::PacketOutCommon::data(void*, unsigned long) fluid/ofcommon/msg.cc:399
SUMMARY: AddressSanitizer: double-free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc8630) in operator delete(void*)
==3908==ABORTING
++++++++++++++++++++++++++++++++++
I am using opensource library for PacketOutCommon
libfluid_msg/msg.cc at a1568eb67773a5efd7c13d4905e1e8977feb9764 * OpenNetworkingFoundation/libfluid_msg * GitHub
My understanding PacektOutCommon has only DTOR. I am not sure what to add copy construcutor, copy assignment, move construcutor and move assignment?
Thanks for your help
Best regards
Sothy