Skip to content

Commit

Permalink
stored: avoid double-free in spool.cc
Browse files Browse the repository at this point in the history
Near the end of DespoolData() rdev->dev_name and rdev->errmsg are freed.
However, the pointers are not set to nullptr, which leads to a
double-free when the dtor runs.
This patch removes the FreeMemory()/FreePoolMemory() calls and leaves
cleaning to the dtor alone.
  • Loading branch information
arogge committed Jun 2, 2020
1 parent 7f37ef2 commit 5543219
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions core/src/stored/spool.cc
Expand Up @@ -412,9 +412,6 @@ static bool DespoolData(DeviceControlRecord* dcr, bool commit)
V(dcr->dev->spool_mutex);
}

FreeMemory(rdev->dev_name);
FreePoolMemory(rdev->errmsg);

/*
* null the jcr
* rdev will be freed by its smart pointer
Expand Down

0 comments on commit 5543219

Please sign in to comment.