diff options
author | David 'Digit' Turner <digit@google.com> | 2014-03-03 11:05:02 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-03-06 00:32:11 +0100 |
commit | 7693d297d269b2d294ce4ce1c854991668eeb8eb (patch) | |
tree | 4e104312da264af7c85b7fa1b6ba8772d6b5294d /emulator | |
parent | bfb9f632d4b0910cde452b116e7ce85c682f69ab (diff) | |
download | sdk-7693d297d269b2d294ce4ce1c854991668eeb8eb.zip sdk-7693d297d269b2d294ce4ce1c854991668eeb8eb.tar.gz sdk-7693d297d269b2d294ce4ce1c854991668eeb8eb.tar.bz2 |
emulator/opengl: Fix SmartPtr memory leak.
Change-Id: I35d0650f2d69b3616167ee03decdc96b7ec09b2a
Diffstat (limited to 'emulator')
-rw-r--r-- | emulator/opengl/shared/emugl/common/smart_ptr.cpp | 4 | ||||
-rw-r--r-- | emulator/opengl/shared/emugl/common/smart_ptr.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/emulator/opengl/shared/emugl/common/smart_ptr.cpp b/emulator/opengl/shared/emugl/common/smart_ptr.cpp index 9ac7339..703487d 100644 --- a/emulator/opengl/shared/emugl/common/smart_ptr.cpp +++ b/emulator/opengl/shared/emugl/common/smart_ptr.cpp @@ -101,8 +101,10 @@ void* SmartPtrBase::release() { mPtr = NULL; mRefCount = NULL; - if (old_refcount->decrement()) + if (old_refcount->decrement()) { + delete old_refcount; return old_ptr; + } } return NULL; diff --git a/emulator/opengl/shared/emugl/common/smart_ptr.h b/emulator/opengl/shared/emugl/common/smart_ptr.h index 2d7db5b..73efdd6 100644 --- a/emulator/opengl/shared/emugl/common/smart_ptr.h +++ b/emulator/opengl/shared/emugl/common/smart_ptr.h @@ -39,7 +39,7 @@ public: // Assignment operator, also increments the reference count. SmartPtrBase& operator=(const SmartPtrBase& other); - // Nothing happens in this constructor, the real work must be performed + // Nothing happens in this destructor, the real work must be performed // in subclasses. ~SmartPtrBase() {} |