typedef struct _route_timer_info_t {
task_timer * withdraw_timer;
std::vector<sockaddr_union> mcast_addr_list;
uint32_t route_block_id;
uint32_t bgp_device_id;
}route_timer_info_t;
I have the above structure in my Code. I have taken a pointer to the above structure and allocated memory from heap.
route_timer_info_t *route_timer=(route_timer_info_t *)malloc(sizeof(route_timer_info_t));
Now to populate the vector, I am doing
route_timer->mcast_addr_list.push_back(some_item)
In the first run size of the vector is coming correct - as many, I am pushing, but when in 2nd run when the whole structure is allocated memory,the size of vector is coming some big garbage value. What could be going wrong? I have tried clearing the vector as well but no help.