From 40e0d2a92b90fe638eb35f47c02c692ff8082a80 Mon Sep 17 00:00:00 2001 From: Winson Date: Mon, 18 Mar 2019 13:46:54 -0700 Subject: 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 --- libs/androidfw/Asset.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libs/androidfw/Asset.cpp') 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; -- cgit v1.2.3-59-g8ed1b