diff mbox series

[FFmpeg-devel] libavformat/rtsp: fix a memory leak in libavformat/rtsp.c

Message ID 20240413042011.1974778-1-lumingyindetect@163.com
State Accepted
Commit 14f9e47314ab70a2c786cb040ca0ca2fc1a0e163
Headers show
Series [FFmpeg-devel] libavformat/rtsp: fix a memory leak in libavformat/rtsp.c | expand


Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

LuMingYin April 13, 2024, 4:20 a.m. UTC
The pointer variable 'fds' allocates a block of dynamic memory in the function 'ffurl_get_multi_file_handle', and the dynamic memory pointed to by this pointer is not released on error paths.

Signed-off-by: LuMingYin <lumingyindetect@163.com>
 libavformat/rtsp.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series


diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b0c61ee00a..db78735c7a 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -2071,6 +2071,7 @@  static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
                 if (fdsnum != 2) {
                     av_log(s, AV_LOG_ERROR,
                            "Number of fds %d not supported\n", fdsnum);
+                    av_freep(&fds);
                     return AVERROR_INVALIDDATA;
                 for (fdsidx = 0; fdsidx < fdsnum; fdsidx++) {