diff options
author | Winson <chiuwinson@google.com> | 2019-03-18 13:46:54 -0700 |
---|---|---|
committer | Winson <chiuwinson@google.com> | 2019-03-18 13:52:48 -0700 |
commit | 40e0d2a92b90fe638eb35f47c02c692ff8082a80 (patch) | |
tree | f208138af217d43143ccbc74bfe00fe4bae2fdad /libs/androidfw/Asset.cpp | |
parent | a232a7abe60261bcbbfa2bc998bae0a1fde13fb7 (diff) |
Delete pAsset* when failing to open chunk from FileAsset
Realistically this doesn't matter because FileAsset always returns
NO_ERROR. But it's worth being correct, in case that ever changes.
Bug: 112146313
Test: none necessary
Change-Id: Iaeddc77c78c93394f96b77533cf8ce30cd1dc370
Diffstat (limited to 'libs/androidfw/Asset.cpp')
-rw-r--r-- | libs/androidfw/Asset.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp index c512a6b06ed1..9a95fdf80cb5 100644 --- a/libs/androidfw/Asset.cpp +++ b/libs/androidfw/Asset.cpp @@ -292,8 +292,10 @@ Asset::Asset(void) pAsset = new _FileAsset; result = pAsset->openChunk(dataMap); - if (result != NO_ERROR) + if (result != NO_ERROR) { + delete pAsset; return NULL; + } pAsset->mAccessMode = mode; return pAsset; |