sim: Fix resource leak in BaseGlobalEvent
Static analysis revealed that BaseGlobalEvent::barrier was never deallocated. This changeset solves this leak by making the barrier allocation a part of the BaseGlobalEvent instead of storing a pointer to a separate heap-allocated barrier.
This commit is contained in:
parent
da4539dc74
commit
11494c4345
2 changed files with 4 additions and 4 deletions
|
@ -34,9 +34,9 @@
|
|||
std::mutex BaseGlobalEvent::globalQMutex;
|
||||
|
||||
BaseGlobalEvent::BaseGlobalEvent(Priority p, Flags f)
|
||||
: barrier(numMainEventQueues),
|
||||
barrierEvent(numMainEventQueues, NULL)
|
||||
{
|
||||
barrierEvent.resize(numMainEventQueues);
|
||||
barrier = new Barrier(numMainEventQueues);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class BaseGlobalEvent : public EventBase
|
|||
// while waiting on the barrier to prevent deadlocks if
|
||||
// another thread wants to lock the event queue.
|
||||
EventQueue::ScopedRelease release(curEventQueue());
|
||||
return _globalEvent->barrier->wait();
|
||||
return _globalEvent->barrier.wait();
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -109,7 +109,7 @@ class BaseGlobalEvent : public EventBase
|
|||
|
||||
//! The barrier that all threads wait on before performing the
|
||||
//! global event.
|
||||
Barrier *barrier;
|
||||
Barrier barrier;
|
||||
|
||||
//! The individual local event instances (one per thread/event queue).
|
||||
std::vector<BarrierEvent *> barrierEvent;
|
||||
|
|
Loading…
Reference in a new issue