Skip to content

Commit 0c12249

Browse files
committed
fix AVDictionary memory leak
1 parent 94c51b6 commit 0c12249

3 files changed

+22
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
1-
From b5176510c15322f2223c5e16af20e65be98db163 Mon Sep 17 00:00:00 2001
1+
From 7f96723900b9103059abc487f57aa34e049e8e9c Mon Sep 17 00:00:00 2001
22
From: qianlongxu <qianlongxu@gmail.com>
3-
Date: Wed, 19 Mar 2025 13:22:27 +0800
4-
Subject: [PATCH 29] bluray protocol add dvd fallback
3+
Date: Fri, 28 Mar 2025 11:15:04 +0800
4+
Subject: [PATCH 27] bluray protocol add dvd fallback
55

66
---
7-
libavformat/demux.c | 24 +++++++++++++++++++++---
8-
1 file changed, 21 insertions(+), 3 deletions(-)
7+
libavformat/demux.c | 31 ++++++++++++++++++++++++++-----
8+
1 file changed, 26 insertions(+), 5 deletions(-)
99

1010
diff --git a/libavformat/demux.c b/libavformat/demux.c
11-
index 51fff7b..05e02db 100644
11+
index 3c8f194..5620e0f 100644
1212
--- a/libavformat/demux.c
1313
+++ b/libavformat/demux.c
14-
@@ -158,7 +158,10 @@ static int init_input(AVFormatContext *s, const char *filename,
14+
@@ -158,7 +158,8 @@ static int init_input(AVFormatContext *s, const char *filename,
1515
int ret;
1616
AVProbeData pd = { filename, NULL, 0 };
1717
int score = AVPROBE_SCORE_RETRY;
1818
-
1919
+ AVDictionary *tmp_opts = NULL;
20-
+ if (options && (av_stristart(filename, "bluray://", NULL) || av_stristart(filename, "dvd://", NULL))) {
21-
+ av_dict_copy(&tmp_opts, *options, 0);
22-
+ }
20+
+
2321
if (s->pb) {
2422
s->flags |= AVFMT_FLAG_CUSTOM_IO;
2523
if (!s->iformat)
26-
@@ -174,8 +177,23 @@ static int init_input(AVFormatContext *s, const char *filename,
24+
@@ -173,10 +174,30 @@ static int init_input(AVFormatContext *s, const char *filename,
25+
if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2726
(!s->iformat && (s->iformat = av_probe_input_format2(&pd, 0, &score))))
2827
return score;
29-
28+
-
3029
- if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, options)) < 0)
3130
- return ret;
31+
-
32+
+
33+
+ if (options && (av_stristart(filename, "bluray://", NULL) || av_stristart(filename, "dvd://", NULL))) {
34+
+ av_dict_copy(&tmp_opts, *options, 0);
35+
+ }
36+
+
3237
+ if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags,
3338
+ options)) < 0) {
3439
+ if (av_stristart(filename, "bluray://", NULL)) {
@@ -43,12 +48,14 @@ index 51fff7b..05e02db 100644
4348
+ av_dict_free(&tmp_opts);
4449
+ return ret;
4550
+ } else {
51+
+ av_dict_free(&tmp_opts);
4652
+ return ret;
4753
+ }
4854
+ }
49-
55+
+ av_dict_free(&tmp_opts);
5056
if (s->iformat)
5157
return 0;
58+
return av_probe_input_buffer2(s->pb, &s->iformat, filename,
5259
--
5360
2.39.5 (Apple Git-154)
5461

patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch renamed to patches/ffmpeg-n6.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 22d3925e8fec79ca0dd23dbdb7eb6f9a9d53ee96 Mon Sep 17 00:00:00 2001
22
From: qianlongxu <qianlongxu@gmail.com>
33
Date: Mon, 24 Mar 2025 09:31:42 +0800
4-
Subject: [PATCH 27] custom bluray fs for network Blu-ray Disc and BDMV
4+
Subject: [PATCH 28] custom bluray fs for network Blu-ray Disc and BDMV
55

66
---
77
libavformat/Makefile | 2 +-

patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch renamed to patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From 28cdd2169e400e113ef6f681d2e1eee8ebc83afa Mon Sep 17 00:00:00 2001
22
From: qianlongxu <qianlongxu@gmail.com>
33
Date: Fri, 21 Mar 2025 19:00:43 +0800
4-
Subject: [PATCH 28] bluray open and find the right m2ts, then read\seek it
4+
Subject: [PATCH 29] bluray open and find the right m2ts, then read\seek it
55
direactly instread of bluray logic.
66

77
---

0 commit comments

Comments
 (0)