liboverlay: Free rotator memory only if it was allocated.
Check if the rotator memory was allocated before attempting to free it. CRs-fixed: 334607 (cherry picked from commit 4feb43e3a964878b2c708e7417df8d116e1d17ef) Change-Id: Iac5d957ce7286848443e3d05f1c8d9c32b258b72
This commit is contained in:
		
				
					committed by
					
						 Andrew Sutherland
						Andrew Sutherland
					
				
			
			
				
	
			
			
			
						parent
						
							297e73b6a9
						
					
				
				
					commit
					08f2e32737
				
			| @@ -126,7 +126,7 @@ void Display::closeDisplay() { | ||||
|     mFD = NO_INIT; | ||||
| } | ||||
|  | ||||
| Rotator::Rotator() : mFD(NO_INIT), mSessionID(NO_INIT), mPmemFD(-1) | ||||
| Rotator::Rotator() : mFD(NO_INIT), mSessionID(NO_INIT), mPmemFD(NO_INIT) | ||||
| { | ||||
|     mAlloc = gralloc::IAllocController::getInstance(false); | ||||
| } | ||||
| @@ -191,9 +191,11 @@ status_t Rotator::closeRotSession() { | ||||
|     if (mSessionID != NO_INIT && mFD != NO_INIT) { | ||||
|         ioctl(mFD, MSM_ROTATOR_IOCTL_FINISH, &mSessionID); | ||||
|         close(mFD); | ||||
|         sp<IMemAlloc> memalloc = mAlloc->getAllocator(mBufferType); | ||||
|         memalloc->free_buffer(mPmemAddr, mSize * mNumBuffers, 0, mPmemFD); | ||||
|         close(mPmemFD); | ||||
|         if (NO_INIT != mPmemFD) { | ||||
|             sp<IMemAlloc> memalloc = mAlloc->getAllocator(mBufferType); | ||||
|             memalloc->free_buffer(mPmemAddr, mSize * mNumBuffers, 0, mPmemFD); | ||||
|             close(mPmemFD); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     mFD = NO_INIT; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user