mirror of https://github.com/aria2/aria2
Fixed the bug due to dangling pointers in RequestGroup.
RequestGroup holds a poitner to btRuntime_ and peerStorage_. After removing them from BtRegistry, we failed to set 0 to them. When program access them, it goes undefined world, such as random crash. We found this bug when pasuing download and valgrind warned memory corruption.pull/1/head
parent
c58f736bb9
commit
97f76b7cf4
|
@ -1021,6 +1021,8 @@ void RequestGroup::releaseRuntimeResource(DownloadEngine* e)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_BITTORRENT
|
#ifdef ENABLE_BITTORRENT
|
||||||
e->getBtRegistry()->remove(gid_);
|
e->getBtRegistry()->remove(gid_);
|
||||||
|
btRuntime_ = 0;
|
||||||
|
peerStorage_ = 0;
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
if(pieceStorage_) {
|
if(pieceStorage_) {
|
||||||
pieceStorage_->removeAdvertisedPiece(0);
|
pieceStorage_->removeAdvertisedPiece(0);
|
||||||
|
|
Loading…
Reference in New Issue