Fix memory leak in nativeDecodeFileDescriptor
Fix memory leak in nativeDecodeFileDescriptor: SkFILEStream::kCallerRetains_Ownership is used to keep life cycle of file in Java,so fclose is not called when destruct SkFILEStream because ownership not belong to native here, while when file is closed in Java, close is called instead of fclose,that means buffer allocated by malloc in fseek, when create SkFrontBufferedStream with this filestream, will not be freed, because this buffer will only be freedin fclose. To fix this issue: duplicate this fd, and use SkFILEStream::kCallerPasses_Ownership for SkFILEStream, means Java and native manage file life cycle separately. CRs-Fixed: 718738 Change-Id: I1c664551ab8d381db2e1f948a2207bc6fb7a11f9
Loading
Please register or sign in to comment