[FFmpeg-trac] #10960(avfilter:new): There is a memory leak defect at line 167 in the file /FFmpeg/libavfilter/af_channelsplit.c.
FFmpeg
trac at avcodec.org
Fri Apr 12 11:21:02 EEST 2024
#10960: There is a memory leak defect at line 167 in the file
/FFmpeg/libavfilter/af_channelsplit.c.
-------------------------------------+-------------------------------------
Reporter: | Type: defect
lumingyindetect |
Status: new | Priority: normal
Component: avfilter | Version: git-
| master
Keywords: memleak | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
There is a memory leak defect at line 167 in the file
/FFmpeg/libavfilter/af_channelsplit.c. The specific triggering steps of
the defect are as follows, with each step accompanied by text and image
explanations.
1.At line 160 in the file /FFmpeg/libavfilter/af_channelsplit.c, a pointer
variable named buf_out is defined, and a dynamic memory area is allocated
through the function av_frame_clone, as shown in the following image:
https://github.com/LuMingYinDetect/FFmpeg_defects/blob/main/FFmpeg_1.png
2.The function of the av_frame_clone function is to allocate a dynamic
memory area and return it. Specifically, at line 595 of the av_frame_clone
function, a pointer variable named ret is defined, and a dynamic memory
area is allocated through the function av_frame_alloc. This pointer is
returned at line 603, as shown in the following image:
https://github.com/LuMingYinDetect/FFmpeg_defects/blob/main/FFmpeg_2.png
3.After the completion of av_frame_clone, when the if statement at line
161 returns false, it indicates that the dynamic memory area pointed to by
buf_out is successfully allocated. However, when the if statement at line
166 returns true, the program will return at line 167. During this
process, the dynamic memory area pointed to by the pointer buf_out is
neither used like at line 169 nor released, thus constituting a memory
leak, as shown in the following image:
https://github.com/LuMingYinDetect/FFmpeg_defects/blob/main/FFmpeg_3.png
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10960>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list