Opened 4 weeks ago

#10960 new defect

There is a memory leak defect at line 167 in the file /FFmpeg/libavfilter/af_channelsplit.c.

Reported by: lumingyindetect Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: memleak
Cc: lumingyindetect Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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

Change History (0)

Note: See TracTickets for help on using tickets.