diff options
author | Tim Murray <timmurray@google.com> | 2013-12-03 11:36:03 -0800 |
---|---|---|
committer | Tim Murray <timmurray@google.com> | 2013-12-12 10:49:20 -0800 |
commit | 3560907fa9b1624eefbd6db5e9c3ccc25ab23b92 (patch) | |
tree | bba012b2f33550dcbf260de7b13dc080641871e8 /cpp/BaseObj.cpp | |
parent | 071aee6b0cffde1ce3ece5e32e34361db2105547 (diff) | |
download | rs-3560907fa9b1624eefbd6db5e9c3ccc25ab23b92.tar.gz |
Fix memory leak due to smart pointer misuse.
bug 11965932
Change-Id: I982b974b3554b0f4dc7a558107703ff605f580e6
Diffstat (limited to 'cpp/BaseObj.cpp')
-rw-r--r-- | cpp/BaseObj.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cpp/BaseObj.cpp b/cpp/BaseObj.cpp index 80d94145..2e0a6377 100644 --- a/cpp/BaseObj.cpp +++ b/cpp/BaseObj.cpp @@ -33,7 +33,7 @@ void * BaseObj::getObjID(sp<const BaseObj> o) { BaseObj::BaseObj(void *id, sp<RS> rs) { - mRS = rs; + mRS = rs.get(); mID = id; } @@ -44,7 +44,9 @@ void BaseObj::checkValid() { } BaseObj::~BaseObj() { - RS::dispatch->ObjDestroy(mRS->getContext(), mID); + if (mRS && mRS->getContext()) { + RS::dispatch->ObjDestroy(mRS->getContext(), mID); + } mRS = NULL; mID = NULL; } |