diff options
author | Jiasheng Jiang <jiashengjiangcool@gmail.com> | 2025-08-02 23:28:48 +0000 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2025-08-04 01:29:44 +0200 |
commit | 9ca58424ded24e931fed329174c28244b67d5670 (patch) | |
tree | ccb37973e701d10e9240c201d6b852c1e9b8941f /doc/examples/avio_read_callback.c | |
parent | ab040e25657436e88a62624b3751a583dfe4e123 (diff) | |
download | ffmpeg-9ca58424ded24e931fed329174c28244b67d5670.tar.gz |
examples: Add av_freep to avoid potential memory leak
Add av_freep() to free avio_ctx_buffer if avio_alloc_context fails
to avoid potential memory leak.
Fixes: 5fc4dea39c ("examples: add avio_reading.c example")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'doc/examples/avio_read_callback.c')
-rw-r--r-- | doc/examples/avio_read_callback.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/doc/examples/avio_read_callback.c b/doc/examples/avio_read_callback.c index dffc061d9f..0a299b4c73 100644 --- a/doc/examples/avio_read_callback.c +++ b/doc/examples/avio_read_callback.c @@ -96,6 +96,7 @@ int main(int argc, char *argv[]) avio_ctx = avio_alloc_context(avio_ctx_buffer, avio_ctx_buffer_size, 0, &bd, &read_packet, NULL, NULL); if (!avio_ctx) { + av_freep(&avio_ctx_buffer); ret = AVERROR(ENOMEM); goto end; } |