summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kaiser <gkaiser@google.com>2019-09-11 14:34:27 -0700
committerGreg Kaiser <gkaiser@google.com>2019-12-03 07:37:52 -0800
commit7426ec8e7853943dc571db9b60d89c849589beb3 (patch)
tree81e488472ad217863994605398c97d134321c092
parent0b975928115ca80f4dfb33c9f0418b593d1472c0 (diff)
BootAnimation: Avoid memory leak in error case
If we fail preloadZip(), we release the animation prior to returning. Test: TreeHugger Change-Id: I632c052ef22b2a7192b516de5726bf4e74544f7a
-rw-r--r--cmds/bootanimation/BootAnimation.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index e1cb7ca6a697..a5aa531fe6f8 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -1157,6 +1157,7 @@ BootAnimation::Animation* BootAnimation::loadAnimation(const String8& fn)
parseAnimationDesc(*animation);
if (!preloadZip(*animation)) {
+ releaseAnimation(animation);
return nullptr;
}