Skip to content

(3.4) videoio(ffmpeg): avoid memory leaks#21820

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
alalek:fix_videoio_ffmpeg_memory_leak_3.4
Apr 5, 2022
Merged

(3.4) videoio(ffmpeg): avoid memory leaks#21820
opencv-pushbot merged 1 commit intoopencv:3.4from
alalek:fix_videoio_ffmpeg_memory_leak_3.4

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Apr 4, 2022

backport #21819

Resolves this valgrind report (caused by incomplete error handling bailout code in open()):

==1086648== 20,910 bytes in 1 blocks are possibly lost in loss record 342 of 423
==1086648==    at 0x4849803: memalign (vg_replace_malloc.c:1516)
==1086648==    by 0x484991F: posix_memalign (vg_replace_malloc.c:1688)
==1086648==    by 0x53AB37E: av_malloc (mem.c:86)
==1086648==    by 0x4DEC3EB: ff_mpeg_er_init (mpeg_er.c:115)
==1086648==    by 0x497B48D: ff_mpv_common_init (mpegvideo.c:974)
==1086648==    by 0x497C753: ff_mpv_encode_init (mpegvideo_enc.c:949)
==1086648==    by 0x49797BF: encode_init (mpeg4videoenc.c:1280)
==1086648==    by 0x4B9EC52: avcodec_open2 (avcodec.c:351)
==1086648==    by 0x49FB47E: CvVideoWriter_FFMPEG::open(char const*, int, double, int, int, bool) (cap_ffmpeg_impl.hpp:2627)
==1086648==    by 0x49FB79F: cvCreateVideoWriter_FFMPEG (cap_ffmpeg_impl.hpp:2757)
==1086648==    by 0x49FCEA5: cv::(anonymous namespace)::CvVideoWriter_FFMPEG_proxy::open(cv::String const&, int, double, cv::Size_<int>, bool) (cap_ffmpeg.cpp:333)
==1086648==    by 0x49FCC01: cv::(anonymous namespace)::CvVideoWriter_FFMPEG_proxy::CvVideoWriter_FFMPEG_proxy(cv::String const&, int, double, cv::Size_<int>, bool) (cap_ffmpeg.cpp:317)
build_contrib:Custom=OFF
build_contrib:Custom Win=OFF

build_shared:Custom=OFF
build_examples:Custom=OFF

build_image:Linux AVX2=ubuntu:20.04

Xbuild_image:Win64=msvs2019

force_builders=Custom,Custom Win,Linux AVX2
Xbuild_image:Custom=centos:7
build_image:Custom=ubuntu:20.04
Xbuild_image:Custom=gstreamer:16.04
buildworker:Custom=linux-1,linux-4,linux-6
test_opencl:Custom=ON

build_image:Custom Win=ffmpeg
Xbuild_image:Custom Win=ffmpeg-plugin
buildworker:Custom Win=windows-2
test_modules:Custom Win=videoio
test_opencl:Custom Win=ON

@opencv-pushbot opencv-pushbot merged commit 0bd261d into opencv:3.4 Apr 5, 2022
@opencv-pushbot opencv-pushbot mentioned this pull request Apr 16, 2022
@opencv-pushbot opencv-pushbot mentioned this pull request Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug category: videoio port/backport done Label for maintainers. Authors of PR can ignore this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants