diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2016-01-04 17:17:21 -0600 |
---|---|---|
committer | Stephen Cprek <smcprek@us.ibm.com> | 2016-02-19 17:06:04 -0600 |
commit | 630c8445144892228a297278c5647222484e0563 (patch) | |
tree | 287720584c0b16eca7722639bf892d7309f20e00 /src/include/util | |
parent | ccdfae6bb89f856ca236d277799dfcb118f80412 (diff) | |
download | talos-hostboot-630c8445144892228a297278c5647222484e0563.tar.gz talos-hostboot-630c8445144892228a297278c5647222484e0563.zip |
shared_ptr::reset did not work for shared pointer
shared_ptr has a common _cleanup function that is used for all
cases where the shared_ptr is deleted or reset. The function
only released the pointer to the held object when the reference
count was 1. Fix so that 'this' shared_ptr always releases its
reference to the shared object.
Change-Id: I28fc8922fa57d62ea86a7fc80a343aa64c22fc33
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/23016
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/util')
-rw-r--r-- | src/include/util/impl/shared_ptr.H | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/include/util/impl/shared_ptr.H b/src/include/util/impl/shared_ptr.H index a6cca17e5..0740d430d 100644 --- a/src/include/util/impl/shared_ptr.H +++ b/src/include/util/impl/shared_ptr.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -171,11 +171,12 @@ namespace std if (count->decrement()) { delete count; - count = nullptr; delete owner; - owner = nullptr; - pointer = nullptr; } + + count = nullptr; + owner = nullptr; + pointer = nullptr; } template<typename U> void _copy(const shared_ptr<U>& r) |