OSDN Git Service

stagefright-plugins: Fix memory leak
authorKeith Mok <kmok@cyngn.com>
Mon, 14 Mar 2016 15:59:00 +0000 (08:59 -0700)
committerKeith Mok <kmok@cyngn.com>
Mon, 14 Mar 2016 19:33:36 +0000 (12:33 -0700)
commitb8759d0fdbebabfab1ecffcbc0223858e5b55458
treebf9433c5a20549cd88027e396ea7841e0a8e2da6
parent770d66eb92274328b4d1a04f195baeba090255c8
stagefright-plugins: Fix memory leak

During deinitDecoder mCtx may not be free due to
codec have not be opened.

CYNGNOS-2239

This fixes:
984 bytes in 1 blocks are definitely lost in loss record 1,174 of 1,286
   at 0x486B8AC: memalign (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
   by 0x486B9C7: posix_memalign (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
   by 0xC1165BB: av_malloc (in /system/vendor/lib/libavutil.so)
   by 0xE0914A7: avcodec_alloc_context3 (in /system/vendor/lib/libavcodec.so)
   by 0xBF2DD2B: android::SoftFFmpegVideo::initDecoder(AVCodecID) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0xBF2DC9B: android::SoftFFmpegVideo::SoftFFmpegVideo(char const*, char const*, OMX_VIDEO_CODINGTYPE, android::CodecProfileLevel const*, unsigned int, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**, AVCodecID) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0xBF2EAC5: android::SoftFFmpegVideo::createSoftOMXComponent(char const*, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0xBF2B651: android::FFmpegOMXPlugin::makeComponentInstance(char const*, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0x53D8DA3: android::OMXMaster::makeComponentInstance(char const*, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**) (in /system/lib/libstagefright_omx.so)
   by 0x53D7331: android::OMX::allocateNode(char const*, android::sp<android::IOMXObserver> const&, unsigned int*) (in /system/lib/libstagefright_omx.so)
   by 0x50271DB: android::QueryCodec(android::sp<android::IOMX> const&, char const*, char const*, bool, android::CodecCapabilities*) (in /system/lib/libstagefright.so)
   by 0x5010EF7: android::MediaCodecList::initializeCapabilities(char const*) (in /system/lib/libstagefright.so)

3,936 bytes in 4 blocks are definitely lost in loss record 1,223 of 1,286
   at 0x486B8AC: memalign (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
   by 0x486B9C7: posix_memalign (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
   by 0xC1165BB: av_malloc (in /system/vendor/lib/libavutil.so)
   by 0xE0914A7: avcodec_alloc_context3 (in /system/vendor/lib/libavcodec.so)
   by 0xBF2BAC9: android::SoftFFmpegAudio::initDecoder(AVCodecID) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0xBF2B92B: android::SoftFFmpegAudio::SoftFFmpegAudio(char const*, char const*, OMX_AUDIO_CODINGTYPE, AVCodecID, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0xBF2D723: android::SoftFFmpegAudio::createSoftOMXComponent(char const*, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0xBF2B619: android::FFmpegOMXPlugin::makeComponentInstance(char const*, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**) (in /system/vendor/lib/libffmpeg_omx.so)
   by 0x53D8DA3: android::OMXMaster::makeComponentInstance(char const*, OMX_CALLBACKTYPE const*, void*, OMX_COMPONENTTYPE**) (in /system/lib/libstagefright_omx.so)
   by 0x53D7331: android::OMX::allocateNode(char const*, android::sp<android::IOMXObserver> const&, unsigned int*) (in /system/lib/libstagefright_omx.so)
   by 0x50271DB: android::QueryCodec(android::sp<android::IOMX> const&, char const*, char const*, bool, android::CodecCapabilities*) (in /system/lib/libstagefright.so)
   by 0x5010EF7: android::MediaCodecList::initializeCapabilities(char const*) (in /system/lib/libstagefright.so)

Change-Id: I623860502bc692663c80bf0f26305270e161df2c
omx/SoftFFmpegAudio.cpp
omx/SoftFFmpegVideo.cpp