Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09901f3b authored by songjinshi's avatar songjinshi Committed by android-build-merger
Browse files

Fix thread race caused double free issue.

am: 5754b41c

Change-Id: Ic9dd6e9c6d216753d997da99158816682d5464d1
parents c9956e2e 5754b41c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1893,6 +1893,7 @@ ZipFileRO* AssetManager::SharedZip::getZip()

Asset* AssetManager::SharedZip::getResourceTableAsset()
{
    AutoMutex _l(gLock);
    ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
    return mResourceTableAsset;
}
@@ -1902,10 +1903,10 @@ Asset* AssetManager::SharedZip::setResourceTableAsset(Asset* asset)
    {
        AutoMutex _l(gLock);
        if (mResourceTableAsset == NULL) {
            mResourceTableAsset = asset;
            // This is not thread safe the first time it is called, so
            // do it here with the global lock held.
            asset->getBuffer(true);
            mResourceTableAsset = asset;
            return asset;
        }
    }