-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a silly use-after-free error in PendingResults
Testing self_heap_ptr for null, and setting it to null after deleting it, won't work if self_heap_ptr is actually the last valid shared_ptr to the PendingResults - then delete self_heap_ptr will delete the very PendingResults that stores self_heap_ptr, and it will be illegal to set self_heap_ptr to null! The call to delete self_heap_ptr must be the last statement in the method, since the object it's in might get deleted at that point. We can still prevent an accidental double-free by just using a boolean that gets changed before deleting the pointer.
- Loading branch information
Showing
2 changed files
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters