* [FFmpeg-devel] [PATCH] doc/examples/avio_http_serve_files: prevent zombie processes
@ 2026-01-05 1:11 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/extract_mvs: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: 0xBat via ffmpeg-devel @ 2026-01-05 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: 0xBat
Ignore SIGCHLD to ensure child processes are reaped automatically by the kernel.
Signed-off-by: 0xBat <monsterbat02@gmail.com>
---
doc/examples/avio_http_serve_files.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/doc/examples/avio_http_serve_files.c b/doc/examples/avio_http_serve_files.c
index 2aae3870c2..8a9bde57c7 100644
--- a/doc/examples/avio_http_serve_files.c
+++ b/doc/examples/avio_http_serve_files.c
@@ -31,6 +31,7 @@
#include <libavformat/avformat.h>
#include <libavutil/opt.h>
#include <unistd.h>
+#include <signal.h>
static void process_client(AVIOContext *client, const char *in_uri)
{
@@ -103,6 +104,7 @@ int main(int argc, char **argv)
const char *in_uri, *out_uri;
int ret, pid;
av_log_set_level(AV_LOG_TRACE);
+ signal(SIGCHLD, SIG_IGN);
if (argc < 3) {
printf("usage: %s input http://hostname[:port]\n"
"API example program to serve http to multiple clients.\n"
--
2.52.0.windows.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH] doc/examples/extract_mvs: fix memory leak in codec context initialization
2026-01-05 1:11 [FFmpeg-devel] [PATCH] doc/examples/avio_http_serve_files: prevent zombie processes 0xBat via ffmpeg-devel
@ 2026-01-05 1:11 ` 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/filter_audio: fix memory leak and duration overflow 0xBat via ffmpeg-devel
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: 0xBat via ffmpeg-devel @ 2026-01-05 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: 0xBat
Ensure the allocated AVCodecContext is properly freed if avcodec_parameters_to_context fails.
Signed-off-by: 0xBat <monsterbat02@gmail.com>
---
| 1 +
1 file changed, 1 insertion(+)
--git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index 5603064d72..b5ed2c5549 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -109,6 +109,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
ret = avcodec_parameters_to_context(dec_ctx, st->codecpar);
if (ret < 0) {
fprintf(stderr, "Failed to copy codec parameters to codec context\n");
+ avcodec_free_context(&dec_ctx);
return ret;
}
--
2.52.0.windows.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH] doc/examples/filter_audio: fix memory leak and duration overflow
2026-01-05 1:11 [FFmpeg-devel] [PATCH] doc/examples/avio_http_serve_files: prevent zombie processes 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/extract_mvs: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
@ 2026-01-05 1:11 ` 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/hw_decode: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: 0xBat via ffmpeg-devel @ 2026-01-05 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: 0xBat
Ensure filter_graph is freed on error and validate duration input to prevent integer overflow.
Signed-off-by: 0xBat <monsterbat02@gmail.com>
---
doc/examples/filter_audio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/examples/filter_audio.c b/doc/examples/filter_audio.c
index ad77bf1f89..bb88f4571b 100644
--- a/doc/examples/filter_audio.c
+++ b/doc/examples/filter_audio.c
@@ -88,6 +88,7 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
abuffer = avfilter_get_by_name("abuffer");
if (!abuffer) {
fprintf(stderr, "Could not find the abuffer filter.\n");
+ avfilter_graph_free(&filter_graph);
return AVERROR_FILTER_NOT_FOUND;
}
@@ -279,6 +280,10 @@ int main(int argc, char *argv[])
}
duration = atof(argv[1]);
+ if (duration > (double)2147483647 / INPUT_SAMPLERATE) {
+ fprintf(stderr, "Duration too long\n");
+ return 1;
+ }
nb_frames = duration * INPUT_SAMPLERATE / FRAME_SIZE;
if (nb_frames <= 0) {
fprintf(stderr, "Invalid duration: %s\n", argv[1]);
--
2.52.0.windows.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH] doc/examples/hw_decode: fix memory leak in codec context initialization
2026-01-05 1:11 [FFmpeg-devel] [PATCH] doc/examples/avio_http_serve_files: prevent zombie processes 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/extract_mvs: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/filter_audio: fix memory leak and duration overflow 0xBat via ffmpeg-devel
@ 2026-01-05 1:11 ` 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/qsv_transcode: check for allocation failure 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/transcode: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
4 siblings, 0 replies; 6+ messages in thread
From: 0xBat via ffmpeg-devel @ 2026-01-05 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: 0xBat
Properly free decoder_ctx on failure to prevent a memory leak during initialization.
Signed-off-by: 0xBat <monsterbat02@gmail.com>
---
doc/examples/hw_decode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/doc/examples/hw_decode.c b/doc/examples/hw_decode.c
index ac4e445505..ce18814760 100644
--- a/doc/examples/hw_decode.c
+++ b/doc/examples/hw_decode.c
@@ -215,8 +215,10 @@ int main(int argc, char *argv[])
return AVERROR(ENOMEM);
video = input_ctx->streams[video_stream];
- if (avcodec_parameters_to_context(decoder_ctx, video->codecpar) < 0)
+ if (avcodec_parameters_to_context(decoder_ctx, video->codecpar) < 0) {
+ avcodec_free_context(&decoder_ctx);
return -1;
+ }
decoder_ctx->get_format = get_hw_format;
--
2.52.0.windows.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH] doc/examples/qsv_transcode: check for allocation failure
2026-01-05 1:11 [FFmpeg-devel] [PATCH] doc/examples/avio_http_serve_files: prevent zombie processes 0xBat via ffmpeg-devel
` (2 preceding siblings ...)
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/hw_decode: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
@ 2026-01-05 1:11 ` 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/transcode: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
4 siblings, 0 replies; 6+ messages in thread
From: 0xBat via ffmpeg-devel @ 2026-01-05 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: 0xBat
Validate return value of av_malloc for dynamic_setting to avoid null pointer dereference.
Signed-off-by: 0xBat <monsterbat02@gmail.com>
---
doc/examples/qsv_transcode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/examples/qsv_transcode.c b/doc/examples/qsv_transcode.c
index 13b4933041..c3f507e8e6 100644
--- a/doc/examples/qsv_transcode.c
+++ b/doc/examples/qsv_transcode.c
@@ -351,6 +351,10 @@ int main(int argc, char **argv)
}
setting_number = (argc - 5) / 2;
dynamic_setting = av_malloc(setting_number * sizeof(*dynamic_setting));
+ if (!dynamic_setting) {
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
current_setting_number = 0;
for (int i = 0; i < setting_number; i++) {
dynamic_setting[i].frame_number = atoi(argv[i*2 + 5]);
--
2.52.0.windows.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH] doc/examples/transcode: fix memory leak in codec context initialization
2026-01-05 1:11 [FFmpeg-devel] [PATCH] doc/examples/avio_http_serve_files: prevent zombie processes 0xBat via ffmpeg-devel
` (3 preceding siblings ...)
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/qsv_transcode: check for allocation failure 0xBat via ffmpeg-devel
@ 2026-01-05 1:11 ` 0xBat via ffmpeg-devel
4 siblings, 0 replies; 6+ messages in thread
From: 0xBat via ffmpeg-devel @ 2026-01-05 1:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: 0xBat
Call avcodec_free_context to release memory if parameters cannot be copied to the context.
Signed-off-by: 0xBat <monsterbat02@gmail.com>
---
doc/examples/transcode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index 1dc1b50502..2bbe091b94 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -94,9 +94,9 @@ static int open_input_file(const char *filename)
}
ret = avcodec_parameters_to_context(codec_ctx, stream->codecpar);
if (ret < 0) {
- av_log(NULL, AV_LOG_ERROR, "Failed to copy decoder parameters to input decoder context "
- "for stream #%u\n", i);
- return ret;
+ av_log(NULL, AV_LOG_ERROR, "Failed to copy decoder parameters to input decoder context for stream #%u\n", i);
+ avcodec_free_context(&codec_ctx);
+ return ret;
}
/* Inform the decoder about the timebase for the packet timestamps.
--
2.52.0.windows.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-06 2:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-05 1:11 [FFmpeg-devel] [PATCH] doc/examples/avio_http_serve_files: prevent zombie processes 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/extract_mvs: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/filter_audio: fix memory leak and duration overflow 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/hw_decode: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/qsv_transcode: check for allocation failure 0xBat via ffmpeg-devel
2026-01-05 1:11 ` [FFmpeg-devel] [PATCH] doc/examples/transcode: fix memory leak in codec context initialization 0xBat via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git