Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFmpegImage: free avpacket side data #10844

Merged
merged 1 commit into from
Nov 3, 2016
Merged

Conversation

Kwiboo
Copy link
Member

@Kwiboo Kwiboo commented Nov 2, 2016

Description

Found this memory leak when looking at a memcheck log:

840 (240 direct, 600 indirect) bytes in 15 blocks are definitely lost in loss record 13,454 of 15,456
  at 0x4843AB8: malloc (vg_replace_malloc.c:298)
  by 0x4845A3B: realloc (vg_replace_malloc.c:785)
  by 0x5472997: av_packet_add_side_data (avpacket.c:303)
  by 0x5472A33: av_packet_new_side_data (avpacket.c:329)
  by 0x5473A1F: ff_side_data_set_encoder_stats (avpacket.c:654)
  by 0x57017DB: ff_mpv_encode_picture (mpegvideo_enc.c:1968)
  by 0x57EEEF7: avcodec_encode_video2 (utils.c:2023)
  by 0x894863: CFFmpegImage::CreateThumbnailFromSurface(unsigned char*, unsigned int, unsigned int, unsigned int, unsigned int, std::string const&, unsigned char*&, unsigned int&) (FFmpegImage.cpp:673)
  by 0xAFD8DB: CPicture::CreateThumbnailFromSurface(unsigned char const*, int, int, int, std::string const&) (Picture.cpp:88)
  by 0xAFE62F: CPicture::CacheTexture(unsigned char*, unsigned int, unsigned int, unsigned int, int, unsigned int&, unsigned int&, std::string const&, CPictureScalingAlgorithm::Algorithm) (Picture.cpp:268)
  by 0x8D036F: CDVDFileInfo::ExtractThumb(std::string const&, CTextureDetails&, CStreamDetails*, int) (DVDFileInfo.cpp:278)
  by 0x867707: CThumbExtractor::DoWork() (VideoThumbLoader.cpp:117)

av_packet_unref takes care of this and should leave m_outputBuffer alone

Motivation and Context

Fixes a memory leak in CFFmpegImage::CreateThumbnailFromSurface

How Has This Been Tested?

Running LibreELEC+Kodi on a WeTek Hub

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the Code guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my change
  • All new and existing tests passed

@fritsch
Copy link
Member

fritsch commented Nov 3, 2016

Seen it! Thx much.

jenkins build and merge

@MartijnKaijser MartijnKaijser added this to the Krypton 17.0-beta6 milestone Nov 3, 2016
@MartijnKaijser MartijnKaijser added Type: Fix non-breaking change which fixes an issue v17 Krypton labels Nov 3, 2016
@jenkins4kodi jenkins4kodi merged commit 8184c32 into xbmc:master Nov 3, 2016
@Kwiboo Kwiboo deleted the free-side-data branch November 4, 2016 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Fix non-breaking change which fixes an issue v17 Krypton
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants