[FFmpeg-devel] [PATCH 0/4] fix multiple memory leaks

2025-06-17 Thread Lidong Yan
+MlJ7wQDAQgHiHgEGBYKACAWIQQCzskBcOehk1y8GoKZR31bPD+6owUCaEpkmQIb DAAKCRCZR31bPD+6ozWxAQC9OFisWrP/hHXUfj8AnC39r5pf5fEBz7lHvFgWNk2b XwD7Bl6kvIIW7ReqtgXvcl7u78vEo+e9YeTGTlmAogjpeQk= =rP+W -END PGP PUBLIC KEY BLOCK- Lidong Yan (4): libavformat/rtmpproto: fix rmtp packet leak in gen_connect

[FFmpeg-devel] [PATCH 4/4] avformat/sapenc: fix leak in sap_write_header()

2025-06-17 Thread Lidong Yan
In sap_write_header(), ff_format_set_url() assign new allocated new_url to contexts[i]->url but forgot to free it later. Add two loops to free contexts[i]->url before av_free(context). Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/sapenc.c | 6 ++ 1

[FFmpeg-devel] [PATCH 2/4] avfilter/asrc_sinc: fix leak in config_input()

2025-06-17 Thread Lidong Yan
In config_input(), fir_to_phase() allocates memory in h[longer]. But if av_calloc() to s->coeffs failed, memory in h[longer] would leak. Add av_free(h[longer]) in !s->coeffs path. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavfilter/asrc_sinc.c | 4 +++- 1 fil

[FFmpeg-devel] [PATCH 1/4] libavformat/rtmpproto: fix rmtp packet leak in gen_connect()

2025-06-17 Thread Lidong Yan
In libavformat/rtmpproto.c:gen_connect(), if check on string length or check on codec fourcc failed, ff_rtmp_packet_create() allocated data in pkt would leak. Add ff_rtmp_packet_destory before return error code. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libav

[FFmpeg-devel] [PATCH 3/4] avformat/sbgdec: fix leak in sbg_read_header()

2025-06-17 Thread Lidong Yan
In sbg_read_header(), if avformat_new_stream() failed, it returns without cleanup, which may cause memory leaks. Replace return statement with goto so that we would first clean up then return. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/sbgdec.c | 6 --

[FFmpeg-devel] [PATCH] avformat/rtmpproto: fix rmtp packet leak in gen_connect()

2025-06-14 Thread Lidong Yan
In libavformat/rtmpproto.c:gen_connect(), if check on string length or check on codec fourcc failed, ff_rtmp_packet_create() allocated data in pkt would leak. Add ff_rtmp_packet_destory before return error code. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> -BEGIN PGP PUBL

[FFmpeg-devel] [PATCH 0/2] fix multiple memory leaks

2025-06-25 Thread Lidong Yan
DAAKCRCZR31bPD+6ozWxAQC9OFisWrP/hHXUfj8AnC39r5pf5fEBz7lHvFgWNk2b XwD7Bl6kvIIW7ReqtgXvcl7u78vEo+e9YeTGTlmAogjpeQk= =rP+W -END PGP PUBLIC KEY BLOCK- Lidong Yan (2): avfilter/asrc_sinc: fix leak in config_input() avformat/sapenc: fix leak in sap_write_header() libavfilter/asrc_sinc.c | 4

[FFmpeg-devel] [PATCH 2/2] avformat/sapenc: fix leak in sap_write_header()

2025-06-25 Thread Lidong Yan
normal execution can fall through cleanup code. Since normal code execution now go through code after fail label, replace fail label with cleanup label. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/sapenc.c | 35 +++ 1 file changed, 1

Re: [FFmpeg-devel] [PATCH 2/2] avformat/sapenc: fix leak in sap_write_header()

2025-06-28 Thread Lidong Yan
Michael Niedermayer writes: > please do the rename in a seperate patch > so there are 2 patches, this makes the changes clearer > Got it. Thanks for your review. Lidong ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/li

[FFmpeg-devel] [PATCH 4/4] avformat/iamf_writer: fix leaks of avio_open_dyn_buf() allocated memory

2025-06-27 Thread Lidong Yan
cleanup code to free dyn_bc. Do the same thing for iamf_write_audio_element() and write_parameter_block(). Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/iamf_writer.c | 47 +-- 1 file changed, 30 insertions(+), 17 deletions(-)

[FFmpeg-devel] [PATCH 2/4] avcodec/vorbisenc: fix leak if av_mallocz failed

2025-06-27 Thread Lidong Yan
In put_main_header(), av_mallocz() allocates memory to local variable buffer, buffer leaks if av_mallocz() to *out failed. Add av_free(buffer) before return error code. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavcodec/vorbisenc.c | 4 +++- 1 file changed, 3 inse

[FFmpeg-devel] [PATCH 1/4] avformat/movenc: fix multiple leaks in error paths

2025-06-27 Thread Lidong Yan
Add av_free(sgpd_entries) before return. In mov_write_track_udta_tag(), avio_open_dyn_buf() allocates a buffer, and this buffer leaks if mov_write_track_kinds() failed. Add cleanup code and goto cleanup if error happened. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- li

[FFmpeg-devel] [PATCH 0/4] fix leaks in movenc, vorbisenc, lut3d and iamf_writer

2025-06-27 Thread Lidong Yan
Fix multiple leaks in error paths. Simply add av_free() in error path or replace return AVERROR* with goto cleanup to prevent from leaks. Lidong Yan (4): avformat/movenc: fix multiple leaks in error paths avcodec/vorbisenc: fix leak if av_mallocz failed avfilter/vf_lut3d: fix leak if

[FFmpeg-devel] [PATCH 3/4] avfilter/vf_lut3d: fix leak if allocate_3dlut failed

2025-06-27 Thread Lidong Yan
In parse_cinespace(), memory allocated in in_prelut[] and out_prelut[] would leak if allocate_3dlut() failed. Replace return ret with goto end to free memory before return error code. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavfilter/vf_lut3d.c | 2 +- 1 file chan

[FFmpeg-devel] [PATCH v2 2/3] avformat/iamf_writer: fix leaks of avio_open_dyn_buf() allocated memory

2025-07-09 Thread Lidong Yan
cleanup code to free dyn_bc. Do the same thing for iamf_write_audio_element() and write_parameter_block(). Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/iamf_writer.c | 47 +-- 1 file changed, 30 insertions(+), 17 deletions(-)

[FFmpeg-devel] [PATCH v2 3/3] swscale/graph: fix leak in adapt_colors()

2025-07-09 Thread Lidong Yan
In adapt_colors(), ff_sws_lut3d_generate() allocates memory in lut. However if add_legacy_sws_pass() failed, lut leaks. free lut before return ret. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libswscale/graph.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[FFmpeg-devel] [PATCH v2 0/3] resend fixes for leaks

2025-07-09 Thread Lidong Yan
lmAogjpeQk= =rP+W -END PGP PUBLIC KEY BLOCK----- Lidong Yan (3): avformat/sapenc: fix leak in sap_write_header() avformat/iamf_writer: fix leaks of avio_open_dyn_buf() allocated memory swscale/graph: fix leak in adapt_colors() libavformat/iamf_wri

[FFmpeg-devel] [PATCH v2 1/3] avformat/sapenc: fix leak in sap_write_header()

2025-07-09 Thread Lidong Yan
normal execution can fall through fail code. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/sapenc.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 87a834a8d8..0567a754e2 100644 --- a

Re: [FFmpeg-devel] [PATCH v2 1/3] avformat/sapenc: fix leak in sap_write_header()

2025-07-12 Thread Lidong Yan
Michael Niedermayer write: > On Thu, Jul 10, 2025 at 10:20:45AM +0800, Lidong Yan wrote: > > In sap_write_header(), ff_format_set_url() assign new allocated new_url > > to contexts[i]->url but forgot to free it later. Add for loop to free > > contexts[i]->url before a

[FFmpeg-devel] [PATCH 1/2] avfilter/asrc_sinc: fix leak in config_input()

2025-06-25 Thread Lidong Yan
to_phase() failed, which in turn means that memory in h[longer] has not been allocated yet. To fix this leak, add av_free(h[longer]) in av_calloc() failed branch would be enough. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavfilter/asrc_sinc.c | 4 +++- 1 file changed, 3 in

Re: [FFmpeg-devel] [PATCH v4 2/3] avformat/sapenc: fix leak in sap_write_header()

2025-07-06 Thread Lidong Yan
Michael Niedermayer writes: > > contexts will be NULL so i would assume contexts[i] will segfault > > thx > Sorry and you are right. Gonna fix. Thanks, Lidong ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ff

Re: [FFmpeg-devel] [PATCH 1/5] avcodec/utvideodec: fix leaks in decode_plane() and decode_plane10()

2025-06-29 Thread Lidong Yan
Michael Niedermayer writes: > This is not correct > > build_huff() does not set these when fsym >= 0 > > your patch runs free() on random uninitialized variables > > before submitting memleak fixes, please verify that > 1. there is actually a leak > 2. your patch does not introduce a new anomaly

[FFmpeg-devel] [PATCH v4 0/3] fix leak in avfilter/asrc_sinc and avformat/sapenc

2025-06-30 Thread Lidong Yan
+6ozWxAQC9OFisWrP/hHXUfj8AnC39r5pf5fEBz7lHvFgWNk2b XwD7Bl6kvIIW7ReqtgXvcl7u78vEo+e9YeTGTlmAogjpeQk= =rP+W -END PGP PUBLIC KEY BLOCK- Lidong Yan (3): avfilter/asrc_sinc: fix leak in config_input() avformat/sapenc: fix leak in sap_write_header() avformat/sapenc: reword fail to cleanup in

[FFmpeg-devel] [PATCH v4 1/3] avfilter/asrc_sinc: fix leak in config_input()

2025-06-30 Thread Lidong Yan
ith goto cleanup to prevent from leaks. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavfilter/asrc_sinc.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c index 6ff3303316..05cf53fe

[FFmpeg-devel] [PATCH v4 2/3] avformat/sapenc: fix leak in sap_write_header()

2025-06-30 Thread Lidong Yan
normal execution can fall through cleanup code. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/sapenc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 87a834a8d8..0882690ba5 100644 --- a/libavfor

[FFmpeg-devel] [PATCH v4 3/3] avformat/sapenc: reword fail to cleanup in sap_write_header()

2025-06-30 Thread Lidong Yan
In sap_write_header(), normal execution would fall through to fail labeled code, thus cleanup would be a better name compared to fail. Replace the use of fail label with cleanup label. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/sapenc.

[FFmpeg-devel] [PATCH v3 2/2] bloom: optimize multiple pathspec items in revision traversal

2025-06-27 Thread Lidong Yan
_info. Add new test cases in t/t4216-log-bloom.sh to ensure - consistent results between the optimization for multiple pathspec items using bloom filter and the case without bloom filter optimization. - does not use bloom filter if any pathspec item is not literal. Signed-off-by: Lidon

[FFmpeg-devel] [PATCH v3 1/2] bloom: replace struct bloom_key * with struct bloom_keyvec

2025-06-27 Thread Lidong Yan
() is added to initialize a key in keyvec. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- bloom.c| 31 +++ bloom.h| 20 revision.c | 36 ++-- revision.h | 6 +++--- 4 files changed, 72 inse

[FFmpeg-devel] [PATCH v3 0/2] bloom: enable bloom filter optimization for multiple pathspec elements in revision traversal

2025-06-27 Thread Lidong Yan
This series enables bloom filter optimization for multiple pathspec elements. Compared to v2, v3 fixed bugs in forbid_bloom_filter() and add one more test case in t/t4216-log-bloom.sh. Lidong Yan (2): bloom: replace struct bloom_key * with struct bloom_keyvec bloom: optimize multiple pathspec

Re: [FFmpeg-devel] [PATCH v3 2/2] bloom: optimize multiple pathspec items in revision traversal

2025-06-27 Thread Lidong Yan
Sorry, I filled in the wrong recipient address. Please forgive me and ignore this email. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ..

[FFmpeg-devel] [PATCH 0/5] fix multiple memory leaks

2025-06-28 Thread Lidong Yan
+6ozWxAQC9OFisWrP/hHXUfj8AnC39r5pf5fEBz7lHvFgWNk2b XwD7Bl6kvIIW7ReqtgXvcl7u78vEo+e9YeTGTlmAogjpeQk= =rP+W -END PGP PUBLIC KEY BLOCK- Lidong Yan (5): avcodec/utvideodec: fix leaks in decode_plane() and decode_plane10() avformat/rtpdec_latm: fix leak in parse_fmtp_config() swscale/graph: fix

[FFmpeg-devel] [PATCH 1/5] avcodec/utvideodec: fix leaks in decode_plane() and decode_plane10()

2025-06-28 Thread Lidong Yan
-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavcodec/utvideodec.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 4c0fa2ca67..f15d623462 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvide

[FFmpeg-devel] [PATCH 2/5] avformat/rtpdec_latm: fix leak in parse_fmtp_config()

2025-06-28 Thread Lidong Yan
av_mallocz() allocates memory in config, but we forget to free it if init_get_bits() failed. Replace return ret with goto end. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/rtpdec_latm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libav

[FFmpeg-devel] [PATCH 0/5] fix multiple memory leaks

2025-06-28 Thread Lidong Yan
This patch series fix multiple memory leaks in error path and early return point. Lidong Yan (5): avcodec/utvideodec: fix leaks in decode_plane() and decode_plane10() avformat/rtpdec_latm: fix leak in parse_fmtp_config() swscale/graph: fix leak in adapt_colors() avcodec/sunrast: fix leak

[FFmpeg-devel] [PATCH 3/5] swscale/graph: fix leak in adapt_colors()

2025-06-28 Thread Lidong Yan
In adapt_colors(), ff_sws_lut3d_generate() allocates memory in lut. However if add_legacy_sws_pass() failed, lut leaks. free lut before return ret. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libswscale/graph.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[FFmpeg-devel] [PATCH 4/5] avcodec/sunrast: fix leak in sunrast_decode_frame()

2025-06-28 Thread Lidong Yan
In sunrast_decode_frame(), we use av_malloc_array() allocates memory to ptr and ptr2. However if buf_end - buf < 1, this function returns error code without freeing this memory thus cause a leak. Add av_freep() before return. Signed-off-by: Lidong Yan <502024330...@smail.nju.

[FFmpeg-devel] [PATCH 5/5] avformat/rtpdec_asf: fix leak in ff_wms_parse_sdp_a_line()

2025-06-28 Thread Lidong Yan
In ff_wms_parse_sdp_a_line(), it allocates memory in buf, but doesn't free buf when avformat_alloc_context() failed. Add av_free(buf) before return to prevent from leak. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> --- libavformat/rtpdec_asf.c | 4 +++- 1 file changed, 3

Re: [FFmpeg-devel] [PATCH 2/4] avfilter/asrc_sinc: fix leak in config_input()

2025-06-28 Thread Lidong Yan
Michael Niedermayer writes: > failure of av_tx_init() with your patch results in a leak: > I send a new patch in https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/345932.html ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/ma

Re: [FFmpeg-devel] [PATCH 2/4] avfilter/asrc_sinc: fix leak in config_input()

2025-06-27 Thread Lidong Yan
Michael Niedermayer wrote: > failure of av_tx_init() with your patch results in a leak: > > ==3653806== 1,260 bytes in 1 blocks are definitely lost in loss record 6 > of 14 > ==3653806==at 0x483E0F0: memalign (in > /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) > ==3653

[FFmpeg-devel] [PATCH v3] avfilter/asrc_sinc: fix leak in config_input()

2025-06-28 Thread Lidong Yan
ith goto cleanup to prevent from leaks. Signed-off-by: Lidong Yan <502024330...@smail.nju.edu.cn> -BEGIN PGP PUBLIC KEY BLOCK- mDMEaEpkmRYJKwYBBAHaRw8BAQdAGwGqH/Dwod+i6kR0/Rhn5GanJ7wK8mM9tWP/ W2qu8Ti0HTUwMjAyNDMzMDA1NkBzbWFpbC5uanUuZWR1LmNuiJkEExYKAEEWIQQC zskBcOehk1y8G

Re: [FFmpeg-devel] [PATCH v3] avfilter/asrc_sinc: fix leak in config_input()

2025-06-29 Thread Lidong Yan
Michael Niedermayer writes: > > +cleanup: > > +av_free(h[longer]); > > return 0; > > this is not the correct return code > Sorry about that, gonna fix. Thanks, Lidong ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/ma