c++ - Aborted: core dumped -
i have structure given below:
struct reply_t { reply_t (unsigned int _xid){ xid = _xid; cb_present = false; buf = null; sz = 0; } unsigned int xid; bool cb_present; // whether reply buffer valid char *buf; // reply buffer int sz; // size of reply buffer };
i have std::map given below:
std::map<unsigned int, std::list<reply_t> > reply_window_;
now here problematic part:
std::map<unsigned int, std::list<reply_t> > :: iterator rep_window; std::list<reply_t> rep_list; std::list<reply_t> :: iterator rep_it; rep_window = reply_window_.find(clt_nonce); if(rep_window!=reply_window_.end()){ for(rep_it=rep_window->second.begin(); \\ rep_it!=rep_window->second.end();rep_it++){ if((*rep_it).xid<=xid_rep){ (*rep_it).cb_present = false; free((*rep_it).buf); } } }
in above code trying free memory allocated *buf of struct reply_t pointed list iterator. not trying free memory allocated structure struct reply_t pointed list iterator. still when run code gives error below:
aborted (core dumped)
could please guide me going on in here?
Comments
Post a Comment