Skip to content
Snippets Groups Projects
Commit d3703697 authored by Eric Cano's avatar Eric Cano
Browse files

Fixed unlocking too late in garbage collection, leading to invalid pointer dereferencing.

parent 8a93fb5e
No related branches found
No related tags found
No related merge requests found
......@@ -72,16 +72,25 @@ void GenericObject::garbageCollect(ScopedExclusiveLock& lock) {
AgentRegister ar(*this);
lock.transfer(ar);
ar.garbageCollect();
// Release the lock now as if we let the caller do, it will point
// to the then-removed ar.
lock.release();
} break;
case serializers::TapePool_t: {
TapePool tp(*this);
lock.transfer(tp);
tp.garbageCollect();
// Release the lock now as if we let the caller do, it will point
// to the then-removed tp.
lock.release();
} break;
case serializers::DriveRegister_t: {
DriveRegister dr(*this);
lock.transfer(dr);
dr.garbageCollect();
// Release the lock now as if we let the caller do, it will point
// to the then-removed dr.
lock.release();
} break;
default: {
std::stringstream err;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment