Project

General

Profile

Actions

Bug #3691

closed

Scheduler::cancelAllEvents causes memory error in ScopedEventId

Added by Junxiao Shi almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Utils
Target version:
Start date:
08/01/2016
Due date:
% Done:

100%

Estimated time:
3.00 h

Description

Snippet to reproduce:

// g++ -o x -std=c++0x x.cpp $(pkg-config --cflags --libs libndn-cxx)
#include <boost/asio.hpp>
#include <ndn-cxx/util/scheduler-scoped-event-id.hpp>

int main()
{
  boost::asio::io_service io;
  ndn::util::scheduler::Scheduler sched(io);
  ndn::util::scheduler::ScopedEventId eid(sched);

  eid = sched.scheduleEvent(ndn::time::milliseconds(10), []{});
  sched.cancelAllEvents();
  eid.cancel();

  return 0;
}

There's a double-free error on eid.cancel() line.
Same error also occurs if eid goes out of scope.

Actions

Also available in: Atom PDF