From 7693d297d269b2d294ce4ce1c854991668eeb8eb Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Mon, 3 Mar 2014 11:05:02 +0100 Subject: emulator/opengl: Fix SmartPtr memory leak. Change-Id: I35d0650f2d69b3616167ee03decdc96b7ec09b2a --- emulator/opengl/shared/emugl/common/smart_ptr.cpp | 4 +++- emulator/opengl/shared/emugl/common/smart_ptr.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'emulator') 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() {} -- cgit v1.1